改造系统alert
2024-08-30 21:22:29
/*************************************************************************
* 改造系统alert
* param str 传入要弹出的str
* pos 弹出的位置 1
* 2
* 3
* return false
*************************************************************************/
window.alert = function (str, pos) {
if (document.getElementById("tAlert") || !str) {
return false;
}
var position = '';
var pos = pos || 1;
var tAlert_wrap = document.createElement("div");
tAlert_wrap.setAttribute("id", "tAlert");
tAlert_wrap.style.textAlign = "center";
tAlert_wrap.style.position = "fixed";
tAlert_wrap.style.zIndex = "100";
switch (pos) {
case 1:
position = '10%';
break;
case 2:
position = '40%';
break;
case 3:
position = "65%";
break;
default:
position = "10%";
break;
}
tAlert_wrap.style.top = position;
tAlert_wrap.style.width = "100%";
document.getElementsByTagName("body")[0].appendChild(tAlert_wrap);
var tAlert_in = document.createElement("div");
tAlert_in.style.padding = "0.125rem 0.4375rem";
tAlert_in.style.maxWidth = "6.25rem";
tAlert_in.style.zIndex = "99";
tAlert_in.style.fontSize = "0.375rem";
tAlert_in.style.textShadow = "none";
tAlert_in.style.display = "inline-block";
tAlert_in.style.lineHeight = "0.5rem";
tAlert_in.style.backgroundColor = "#000000";
tAlert_in.style.color = "#ffffff";
tAlert_in.style.borderRadius = "0.1875rem";
tAlert_in.style.opacity = "0.8";
tAlert_in.style.wordBreak = "break-all";
tAlert_in.textContent = str;
document.getElementById("tAlert").appendChild(tAlert_in);
setTimeout(function () {
document.getElementsByTagName("body")[0].removeChild(tAlert_wrap);
}, 2000);
return false;
}
牛了个逼,改造后,弹出会更美丽。弹出会自动关闭。弹出的位置可以自动调整。
最新文章
- Intent传递list<;bean>;集合
- 平时一些mysql小技巧及常识
- Net重温之路一
- vim自动补全插件YouCompleteMe
- 360兼容模式==ie8 兼容模式下 span标签占位问题
- MULTIBYTETOWIDECHAR的与WIDECHARTOMULTIBYTE的参数详解及相互转换
- php 返回json 解析 报Wide character in print
- php等号(==)与全等(===)
- crawler_java应用集锦9:httpclient4.2.2的几个常用方法,登录之后访问页面问题,下载文件_设置代理
- h5的video标签
- 五:用JAVA写一个阿里云VPC Open API调用程序
- Dynamics CRM2013 6.1.1.1143版本插件注册器的一个bug
- windows 允许其他电脑访问本地mysql数据库
- jquery简易tab切换
- 深入理解volatile
- paymob浙江正和
- WPF Combobox选中事件
- 18. 4Sum (通用算法 nSum)
- [EffectiveC++]item45:运用成员函数模板接受所有兼容类型
- EDK_II环境搭建与测试
热门文章
- 笔试算法题(08):输出倒数第K个节点
- django 使用框架下auth.models自带的User进行扩展增加字段
- socketserver模块使用方法
- 原生JS版和jQuery 版实现文件上传功能
- shit IE &; no table `border-collapse: collapse;`
- hdu3592(差分约束) (线性)
- Codeforces908G. New Year and Original Order
- Nginx 的 server_names_hash_bucket_size 问题
- 创建Django项目(六)——模板
- Ubuntu 16.04升级4.7.0内核后导致Compiz奔溃,问题:compiz[4852]: segfault at 48 ip 00007f88cae087f0 sp 00007ffce354c268 error 4 in libscale.so