重写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年出版,到现在已经将 ...
随机推荐
- 聊一聊HTML <!--…-->标签
定义 注释标签用于在html源代码中插入注释.注释不会在浏览器上显示. 用法 根据定义的基本用法,代码如下 <!-- 这是一段注释,我不会显示在页面上 --> 浏览器的支持情况 所有浏览器 ...
- zip unzip tar 压缩解压
yum install -y unzip zip yum安装zip -r mydata.zip mydata mydata目录压缩为mydata.zipunzip mydata.zip - ...
- LeetCode——Maximum Product of Three Numbers
Question Given an integer array, find three numbers whose product is maximum and output the maximum ...
- sql 取前一年、月
SQL SERVER 提供了一些时间函数:取当前时间:SELECT GETDATE() 取前一个月的时间:SELECT DATEADD(MONTH,-1,GETDATE()) 月份减一个月取年份:SE ...
- 数据结构实习 - problem K 用前序中序建立二叉树并以层序遍历和后序遍历输出
用前序中序建立二叉树并以层序遍历和后序遍历输出 writer:pprp 实现过程主要是通过递归,进行分解得到结果 代码如下: #include <iostream> #include &l ...
- SpringBoot项目结构介绍
一项目结构介绍 springboot框架本身对项目结构并没有特别的要求,但是按照最佳的项目结构可以帮助我们减少可能遇到的错误问题.结构如下: (1)应用主类SpringbootApplication应 ...
- spring MVC 及 AOP 原理
SpringMVC工作原理https://www.cnblogs.com/xiaoxi/p/6164383.htmlspring MVC 原理https://blog.csdn.net/y199108 ...
- Android 数据库 ObjectBox 源码解析
一.ObjectBox 是什么? greenrobot 团队(现有 EventBus.greenDAO 等开源产品)推出的又一数据库开源产品,主打移动设备.支持跨平台,最大的优点是速度快.操作简洁,目 ...
- hadoop1.2.1伪分布模式安装教程
1:软件环境准备 1.1Hadoop: 我们使用hadoop Release 1.2.1(stable)版本,下载链接: http://mirrors.ustc.edu.cn/apache/hadoo ...
- 变更Linux下的Java版本 alternatives
默认正常情况下,即使使用Java 1.6版本Java脚本jdk-6u31-linux-i586.bin,安装Java运行后,会出现自动升级为1.7版本状态的情况.针对某些应用程序需要基于1.6版本方可 ...