/*************************************************************************
* 改造系统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;
}

牛了个逼,改造后,弹出会更美丽。弹出会自动关闭。弹出的位置可以自动调整。

最新文章

  1. Intent传递list<bean>集合
  2. 平时一些mysql小技巧及常识
  3. Net重温之路一
  4. vim自动补全插件YouCompleteMe
  5. 360兼容模式==ie8 兼容模式下 span标签占位问题
  6. MULTIBYTETOWIDECHAR的与WIDECHARTOMULTIBYTE的参数详解及相互转换
  7. php 返回json 解析 报Wide character in print
  8. php等号(==)与全等(===)
  9. crawler_java应用集锦9:httpclient4.2.2的几个常用方法,登录之后访问页面问题,下载文件_设置代理
  10. h5的video标签
  11. 五:用JAVA写一个阿里云VPC Open API调用程序
  12. Dynamics CRM2013 6.1.1.1143版本插件注册器的一个bug
  13. windows 允许其他电脑访问本地mysql数据库
  14. jquery简易tab切换
  15. 深入理解volatile
  16. paymob浙江正和
  17. WPF Combobox选中事件
  18. 18. 4Sum (通用算法 nSum)
  19. [EffectiveC++]item45:运用成员函数模板接受所有兼容类型
  20. EDK_II环境搭建与测试

热门文章

  1. 笔试算法题(08):输出倒数第K个节点
  2. django 使用框架下auth.models自带的User进行扩展增加字段
  3. socketserver模块使用方法
  4. 原生JS版和jQuery 版实现文件上传功能
  5. shit IE & no table `border-collapse: collapse;`
  6. hdu3592(差分约束) (线性)
  7. Codeforces908G. New Year and Original Order
  8. Nginx 的 server_names_hash_bucket_size 问题
  9. 创建Django项目(六)——模板
  10. Ubuntu 16.04升级4.7.0内核后导致Compiz奔溃,问题:compiz[4852]: segfault at 48 ip 00007f88cae087f0 sp 00007ffce354c268 error 4 in libscale.so