Alert方法重写
在正规项目中,总感觉alert框是非常难看的,但是有的时候又必须添加alert框来给用户一种警醒,废话不多说,先上图
aaarticlea/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCACDAUcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD27wL8ONS+IP27+zri0g+ybN/2p2XO/djG1T/dP6V1X/DOHiT/AJ/9J/7/AEv/AMbrS/Zzn8n/AISH3+z/APtWvZ/tv0oA8G/4Zw8Sf8/+k/8Af6X/AON0f8M4eJP+f/Sf+/0v/wAbr3n7b9KPtv0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8Ax9v8aKKAD+xLL/nj/wCPt/jRRRQB/9k=" alt="" />
下面是脚本代码,基于jQuery的
/// <summary>
/// 重写alert方法
/// </summary>
/// <param name="message">消息内容</param>
/// <param name="title">弹出窗标题</param>
/// <param name="title">点击确认按钮的回调函数</param>
window.alert = function (message, title, callbak) {
/// <summary>
/// 关闭Alert弹出窗
/// </summary>
(closeAlert = function () { $('#alert-window').remove(); })();
var bg = $('<div class="alert-bg"></div>');
var wnd = $('<div class="alert-wnd"><div class="alert-head"><center>'
+ (title || "提示信息")
+ '</center></div><div class="alert-body"><div class="alert-icon"><span></span></div><div class="alert-msg"><p>'
+ (message || '') + '</p></div></div><div class="alert-footer"><a class="btn btn-small" id="alert-confirm">确认</a></div></div>');
window.top.$(document.body).append($('<div id="alert-window"></div>').append(bg).append(wnd).delegate('#alert-confirm', 'click', function () { closeAlert(); callbak && callbak(); }));
};
下面是css代码:
.btn {
background-color: #F5F5F5;
background-image: linear-gradient(to bottom, #FFFFFF, #E6E6E6);
background-repeat: repeat-x;
border-bottom: 0 none #B3B3B3;
border-radius: 4px;
border-right: 0 none #E6E6E6;
border-top: 0 none #E6E6E6;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
color: #333333;
cursor: pointer;
display: inline;
font-size: 14px;
line-height: 20px;
margin-bottom:;
padding: 4px 12px;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
vertical-align: middle;
}
a, input[type="button"] {
border-left: 1px none;
}
a {
color: #007FBF;
outline: medium none;
text-decoration: none;
}
a {
color: #0088CC;
text-decoration: none;
}
.alert-bg {
background-color: #999999;
bottom:;
left:;
position: fixed;
right:;
top:;
z-index:;
opacity: 0.3;
} .alert-wnd {
width: 320px;
height: 120px;
margin-left: -160px;
margin-top: -160px;
box-shadow: 5px 5px 5px #AAAAAA;
left: 50%;
top: 50%;
z-index:;
background-color: #ffffff;
font-family: 'Microsoft YaHei';
font-size: 12px;
opacity:;
position: fixed;
border: 5px solid #999999;
} .alert-wnd .alert-head {
height: 24px;
border-bottom: 1px solid #999999;
font-weight:;
background-image: -moz-linear-gradient(top, #F1F1F1, #CCCCCC); /* Firefox */
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #F1F1F1), color-stop(1, #CCCCCC)); /* Saf4+, Chrome */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#F1F1F1', endColorstr='#CCCCCC', GradientType='0'); /* IE*/
} .alert-wnd .alert-body {
height: 60px;
} .alert-wnd .alert-body .alert-icon {
width: 80px;
height: 60px;
float: left;
} .alert-wnd .alert-body .alert-icon span {
background-image: url("../img/alert.png");
width: 32px;
height: 32px;
display: block;
float: left;
margin-left: 20px;
margin-top: 15px;
} .alert-wnd .alert-body .alert-msg {
float: left;
width: 240px;
height: 60px;
} .alert-wnd .alert-body .alert-msg p {
margin-top: 20px;
width: 225px;
}
.btn {
background-color: #F5F5F5;
background-image: linear-gradient(to bottom, #FFFFFF, #E6E6E6);
background-repeat: repeat-x;
border-bottom: 0 none #B3B3B3;
border-radius: 4px;
border-right: 0 none #E6E6E6;
border-top: 0 none #E6E6E6;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
color: #333333;
cursor: pointer;
display: inline;
font-size: 14px;
line-height: 20px;
margin-bottom:;
padding: 4px 12px;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
vertical-align: middle;
}
a, input[type="button"] {
border-left: 1px none;
}
a {
color: #007FBF;
outline: medium none;
text-decoration: none;
}
a {
color: #0088CC;
text-decoration: none;
}
/*文飞 20:52:07 */
.btn:active,
.btn.active {
background-color: #cccccc \9;
} .btn:first-child {
*margin-left:;
} .btn:hover,
.btn:focus {
color: #333333;
text-decoration: none;
background-position: 0 -15px;
-webkit-transition: background-position 0.1s linear;
-moz-transition: background-position 0.1s linear;
-o-transition: background-position 0.1s linear;
transition: background-position 0.1s linear;
} .btn:focus {
outline: thin dotted #333;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
} .btn.active,
.btn:active {
background-image: none;
outline:;
-webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
}
对了还有一个资源文件
当加上上述代码到你的工程中,普通的alert方法就会产生如图的效果。这样alert的样式就随心所欲了。
现在还有没解决的问题是,这种alert框不能像浏览器自带的alert框那样停止脚本的运行,有没有完美的解决方案呢?
Alert方法重写的更多相关文章
- 重写alert方法,去掉地址显示
//重写alert方法,去掉地址显示window.alert = function(name){ var iframe = document.createElement("IFRAME&qu ...
- 重写alert方法完成类似gmail的友好提示
当在网页中调用aelrt()方法的时候,系统会自动显示友好的提示方式 . 下面是css样式控制代码: /*----------------------------------------------- ...
- 【java开发】方法重写和方法重载概述
类的继承 父类-子类 关键字 extends 新建一个父类 public class Person { private String name; private int ...
- 学习ASP.NET Web API框架揭秘之“HTTP方法重写”
最近在看老A的<ASP.NET Web API 框架揭秘>,这本书对于本人现阶段来说还是比较合适的(对于调用已经较为熟悉,用其开发过项目,但未深入理解过很多内容为何可以这样“调用”).看到 ...
- 方法重写和方法重载;this关键字和super关键字
1:方法重写和方法重载的区别?方法重载能改变返回值类型吗? 方法重写: 在子类中,出现和父类中一模一样的方法声明的现象. 方法重载: 同一个类中,出现的方法名相同,参数列表不同的现象. 方法重载能改变 ...
- 疯狂java学习笔记之面向对象(六) - 构造器重载、方法重载和方法重写
一.方法重载(Overload): Java允许同一个类中定义多个同名方法,只要形参不一样就可以,如果同一个类中包含了两个或两个以上方法名相同的方法,但形参列表不同,则被成为方法重载(两同一异). 同 ...
- 用HashSet的add方法谈hashcode和equals方法重写
本文主要通过用HashSet的add方法讲一下hashCode和equals方法重写.错误的地方望指正. 1.了解HashSet的add方法 了解一个方法的好办法是看源码,所以先看源码 private ...
- Java中实例方法,实例变量,静态方法,静态变量,final方法重写的问题,覆盖
Java中只有非私有的实例方法能被重写,即实现多态,子类可以覆盖父类的方法,但是实例变量不能覆盖,若子类和父类均定义了同样名称的变量,则对于子类来说这是两个不同的变量,要想调用父类的变量必须显示去调用 ...
- Objective-c 类的继承 方法重写 方法重载
一.类的继承 Objective-c中类的继承与C++类似,不同的是Objective-c不支持多重继承,一个类只能有一个父类,单继承使Objective-c的继承关系很简单,易于管理程序. Obje ...
随机推荐
- setf
independent flags boolalpha read/write bool elements as alphabetic strings (true and false). showbas ...
- cad 画 tp图
本文记录了cad 绘制 结构图 和触摸屏激光图. 1作为一个新手,我先要做的是适应操作界面. 页面:ctrl+鼠标滚轮 (类比,ps,ad等软件都是这样的.) 选取,划线,图层.等... 2画图... ...
- Express4 Route笔记
可以参考Express官网关于路由一节:http://expressjs.com/guide/routing.html 1:通过使用GET.POST方式定义主页路由,app.js: var expre ...
- 游览器对js加载的次序
直接看例子 <body> <script> console.log("first"); var script = document.createElemen ...
- 同行blog收集
姜楠:http://www.slyar.com/blog/ 赵劼:http://blog.zhaojie.me/ 研究者July:http://my.csdn.net/v_JULY_v 王卓群:htt ...
- 全球扫货指南:面向中国消费者的全球奢侈品旅游导购服务 |PingWest中文网
全球扫货指南:面向中国消费者的全球奢侈品旅游导购服务 |PingWest中文网 用"全球扫货指南
- redis 学习笔记三(队列功能)
Redis队列功能介绍 List 常用命令: Blpop删除,并获得该列表中的第一元素,或阻塞,直到有一个可用 Brpop删除,并获得该列表中的最后一个元素,或阻塞,直到有一个可用 Brpoplpus ...
- paip.索引优化---sql distict—order by 法
paip.索引优化---sql distict—order by 法 作者Attilax , EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog ...
- <php>json小结
1.页面中如果即用到jquery包,又用到js文件,要先写jquery包,再加载js文件 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tr ...
- <PHP>字符串处理代码
字符串处理: strlen("aaa");取字符串的长度 *** strcmp("aaa","aaa");比较两个字符串 ...