重写alert 方法(我胡汉三又回来了)
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 方法(我胡汉三又回来了)的更多相关文章
- 重写alert方法,去掉地址显示
//重写alert方法,去掉地址显示window.alert = function(name){ var iframe = document.createElement("IFRAME&qu ...
- 重写alert方法完成类似gmail的友好提示
当在网页中调用aelrt()方法的时候,系统会自动显示友好的提示方式 . 下面是css样式控制代码: /*----------------------------------------------- ...
- 【hh】我胡汉三又回来了
hh 差不多半年没来机房了,高一的都已经碾压我100题了 开始得比较晚,估计比高一的早两三个月吧,停了这半年落下了不少. 但是没有关系啊,学OI纯粹是好玩嘛,一开始报名的时候根本不知道有联赛这回事(其 ...
- Alert方法重写
在正规项目中,总感觉alert框是非常难看的,但是有的时候又必须添加alert框来给用户一种警醒,废话不多说,先上图
- 重写Alert和confirm方法去除地址显示
//重写alert方法,去掉地址显示window.alert = function(name){var iframe = document.createElement("IFRAME&quo ...
- Effective Java 第三版——10. 重写equals方法时遵守通用约定
Tips <Effective Java, Third Edition>一书英文版已经出版,这本书的第二版想必很多人都读过,号称Java四大名著之一,不过第二版2009年出版,到现在已经将 ...
- Effective Java 第三版——11. 重写equals方法时同时也要重写hashcode方法
Tips <Effective Java, Third Edition>一书英文版已经出版,这本书的第二版想必很多人都读过,号称Java四大名著之一,不过第二版2009年出版,到现在已经将 ...
- Effective Java 第三版——12. 始终重写 toString 方法
Tips <Effective Java, Third Edition>一书英文版已经出版,这本书的第二版想必很多人都读过,号称Java四大名著之一,不过第二版2009年出版,到现在已经将 ...
- Effective Java 第三版——13. 谨慎地重写 clone 方法
Tips <Effective Java, Third Edition>一书英文版已经出版,这本书的第二版想必很多人都读过,号称Java四大名著之一,不过第二版2009年出版,到现在已经将 ...
随机推荐
- Mybatis 一对多 简单映射配置
只需在一对多的 “一” Model中定义一个list集合: public class SelectQuestion{ // 主键ID private Integer id; private Strin ...
- Java 线程池submit和execute
submit方法: public abstract class AbstractExecutorService implements ExecutorService { protected <T ...
- 混合开发的大趋势之一React Native之页面跳转(2)+物理返回+特定平台代码
转载请注明出处:这里写链接内容 今天是10月份的最后一天,我加了3个月来的第一个班,挤出了这篇. 废话不多先安利,然后继续学习 RN 有好东西都往里面丢,努力做好归纳 https://github.c ...
- python下载网页上公开数据集
URL很简单,数据集分散开在一个URL页面上,单个用手下载很慢,这样可以用python辅助下载: 问题:很多国外的数据集,收到网络波动的影响很大,最好可以添加一个如果失败就继续请求的逻辑,这里还没有实 ...
- powershell如何查看以及设置环境变量
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment ...
- 【semantic segmentation】Pyramid Scene Parsing Network(转)
论文地址:https://arxiv.org/pdf/1612.01105.pdf源码地址:https://github.com/hszhao/PSPNet 来自:Semantic Segmentat ...
- 我的nlp之路(1)
1/8日任务 基础篇: 如何使用远程连接从windows或者linux连到服务器进行操作(切换用户,传递文件) (严禁使用root账户) Linux基本bash命令 a) 查看文件大小, ...
- u-boot-2015.07 autoconf.mk生成过程分析
1.u-boot2015.7版本编译没有在顶层目录中生成.config文件,而生成了include/autoconf.mk和include/autoconf.mk.dep两个文件,并在每个模块编译的时 ...
- Codeforces Round #361 (Div. 2) E. Mike and Geometry Problem 离散化+逆元
E. Mike and Geometry Problem time limit per test 3 seconds memory limit per test 256 megabytes input ...
- Sorl初始
Sorl是什么 ? Solr是Apache下的一个开源项目,使用Java基于Lucene开发的全文检索服务:是一个独立的企业级搜索应用服务器,它对外提供类似于Web-service的API接口.用户可 ...