window.alert = function (txt) {
var shield = document.createElement("DIV");
shield.id = "shield";
shield.style.position = "absolute";
shield.style.left = "0px";
shield.style.top = "0px";
shield.style.width = "100%";
shield.style.height = document.body.scrollHeight + "px";
shield.style.background = "#333";
shield.style.textAlign = "center";
shield.style.zIndex = "10000";
shield.style.filter = "alpha(opacity=50);";
shield.style.opacity = 0.5;
var alertFram = document.createElement("DIV");
alertFram.id = "alertFram";
alertFram.style.position = "absolute"; alertFram.style.marginTop = "-" + (document.body.scrollHeight - document.body.scrollTop - (window.screen.availHeight / 2) + 180) + "px";
alertFram.style.marginLeft = (document.body.clientWidth / 2 - 200) + "px";
alertFram.style.width = "400px";
alertFram.style.height = "180px";
alertFram.style.background = "#4c4c4c";
alertFram.style.textAlign = "center";
alertFram.style.lineHeight = "180px";
alertFram.style.zIndex = "10001";
strHtml = "<ul style=\"list-style:none;margin:0px;padding:10px;width:380px; height:160px;\">\n";
strHtml += " <li style=\"background:#fff;text-align:left;padding-left:15px;font-size:14px;font-weight:bold;height:39px;line-height:39px;border-bottom:1px solid #c8c8c8;\">温馨提示<span style=\" float:right; margin-right:15px; font-size:15px; cursor:pointer;\" onclick=\"doOk()\">×</span></li>\n";
strHtml += " <li style=\"background:#fff;text-align:center;font-size:13px;height:80px;line-height:80px;\">" + txt + "</li>\n";
strHtml += " <li style=\"background:#fff;text-align:center;height:40px;line-height:40px;\"><input type=\"button\" style=\"width:78px; height:28px; border:1px #be1414 solid; color:#fff; font-size:14px; background:#e52828;\" value=\"确 定\" onclick=\"doOk()\" /></li>\n";
strHtml += "</ul>\n";
alertFram.innerHTML = strHtml;
document.body.appendChild(alertFram);
document.body.appendChild(shield);
var c = 0;
this.doAlpha = function () {
if (c++ > 20) { clearInterval(ad); return 0; }
shield.style.filter = "alpha(opacity=" + c + ");";
}
var ad = setInterval("doAlpha()", 5);
this.doOk = function () {
alertFram.style.display = "none";
shield.style.display = "none";
}
alertFram.focus();
document.body.onselectstart = function () { return false; };
};


兼容性还没测试  哈哈 ~ 各位借鉴哦

重写alert 方法(我胡汉三又回来了)的更多相关文章

  1. 重写alert方法,去掉地址显示

    //重写alert方法,去掉地址显示window.alert = function(name){ var iframe = document.createElement("IFRAME&qu ...

  2. 重写alert方法完成类似gmail的友好提示

    当在网页中调用aelrt()方法的时候,系统会自动显示友好的提示方式 . 下面是css样式控制代码: /*----------------------------------------------- ...

  3. 【hh】我胡汉三又回来了

    hh 差不多半年没来机房了,高一的都已经碾压我100题了 开始得比较晚,估计比高一的早两三个月吧,停了这半年落下了不少. 但是没有关系啊,学OI纯粹是好玩嘛,一开始报名的时候根本不知道有联赛这回事(其 ...

  4. Alert方法重写

    在正规项目中,总感觉alert框是非常难看的,但是有的时候又必须添加alert框来给用户一种警醒,废话不多说,先上图

  5. 重写Alert和confirm方法去除地址显示

    //重写alert方法,去掉地址显示window.alert = function(name){var iframe = document.createElement("IFRAME&quo ...

  6. Effective Java 第三版——10. 重写equals方法时遵守通用约定

    Tips <Effective Java, Third Edition>一书英文版已经出版,这本书的第二版想必很多人都读过,号称Java四大名著之一,不过第二版2009年出版,到现在已经将 ...

  7. Effective Java 第三版——11. 重写equals方法时同时也要重写hashcode方法

    Tips <Effective Java, Third Edition>一书英文版已经出版,这本书的第二版想必很多人都读过,号称Java四大名著之一,不过第二版2009年出版,到现在已经将 ...

  8. Effective Java 第三版——12. 始终重写 toString 方法

    Tips <Effective Java, Third Edition>一书英文版已经出版,这本书的第二版想必很多人都读过,号称Java四大名著之一,不过第二版2009年出版,到现在已经将 ...

  9. Effective Java 第三版——13. 谨慎地重写 clone 方法

    Tips <Effective Java, Third Edition>一书英文版已经出版,这本书的第二版想必很多人都读过,号称Java四大名著之一,不过第二版2009年出版,到现在已经将 ...

随机推荐

  1. 定制Writable类

    以IntWritable为例介绍,定制writable的步骤 //继承 WritableComparable接口(继承了writable接口和comparable接口) public class In ...

  2. SaltStack部署服务及配置管理apache+php-第二篇

    实验目标 1.使用SaltStack部署apache和php, 2.使用salt管理httpd.conf配置文件配置访问info.php使用账户密码 3.在salt里面增加对conf.d目录进行配置管 ...

  3. Win7旗舰版中的IIS配置asp.net 完美通过版,附代码 以及出现的 CS0016: 未能写入输出文件“c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\8d57d

    先解决问题:“c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\8d57d 图: 其他的解决方案 ...

  4. Web前端可以转行做游戏吗?

    作者:ManfredHu 链接:http://www.manfredhu.com/2018/03/15/31-laya-game-tips/index.html 声明:版权所有,转载请保留本段信息,谢 ...

  5. linux:将job放在后台执行的方法

    本文转自http://www.ibm.com/developerworks/cn/linux/l-cn-nohup/ 我自己在工作需要远程连到公司的开发机,在开发机上运行程序时,一旦退出终端就会导致运 ...

  6. gcc编译出错---make[5]: *** [s-attrtab] Killed

    内存不足导致的编译出错,解决方法是增加swapfile. root@ubuntu:home# swapon -s Filename    Type            Size    Used    ...

  7. Harbor 定制页面 和 二次开发指南

    harbor的官方地址:https://github.com/goharbor/harbor 想对Harbor进行二次开发,首先要指定一个harbor的版本,这里我们以Harbor:1.6.2为例: ...

  8. 《用 Python 学微积分》笔记 3

    <用 Python 学微积分>原文见参考资料 1. 16.优化 用一个给定边长 4 的正方形来折一个没有盖的纸盒,设纸盒的底部边长为 l,则纸盒的高为 (4-l)/2,那么纸盒的体积为: ...

  9. redis——redis主从复制

    和MySQL主从复制的原因一样,Redis虽然读取写入的速度都特别快,但是也会产生读压力特别大的情况.为了分担读压力,Redis支持主从复制,Redis的主从结构可以采用一主多从或者级联结构,Redi ...

  10. Android----- 改变图标原有颜色 和 搜索框

    本博客主要讲以下两点知识点 图标改变颜色:Drawable的变色,让Android也能有iOS那么方便的图片色调转换,就像同一个图标,但是有多个地方使用,并且颜色不一样,就可以用这个方法了. 搜索框: ...