在网上找了一些弹窗插件,例如bootbox, 功能和动画效果都做的很好,但是很难自定义样式。

项目需要,Google相关方法后写了一个Demo, 没有JavaScript confirm切断线程的功能,但是使用了回调函数,足以实现弹窗对话效果。

效果图:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZgAAAEXCAIAAAAfv8UPAAAgAElEQVR4nO2d/XMb1b3w9w/ghzvTeUbTHxg//aHNDDM0MzCDLrczFXcKUW8LiJYXhzSJgBB8Ya4rCqVuAyU0CdlLIHUgjp04IQohQemlicolxHmhiBCSteUXJU5sJw5UoY9t2XrbXWmlleVE+/ywb+esdiV5ZWe95vvha2n37DnfPXus8/FqtQrE0EdvK3Hxb9sif90aPrSFOkiG/BtOdL4aePOFv7a/Pnzh/PmB/kh/H8T5gf7hixeO/u3I/waPUF9+2d8btrxLpqO/N9zb09197hx19uyXX3xx/JNju3d1/uUvh2aKRTHkp2JReZ4pzqiLSvGMXIQ0KCo1Z2aKM9LjzIyyWVmaUVvNyLWkrTNSErk7UqmcTd2J2ssZdesMsg8xZmZ/aNPv/vlPb764+oMtv/l4x7qunX88sevVk7vX//3dP4X8Gz7ftxHipgV1kAwf2hL569aLf9uGWmvoo7ffJ30EarG+v7x5cvf690nfng3P7Xhl7c6Nz3e2bm575+327e9AoLFj+zvvdu7auaPN8p7MYRz58MO+3rDqi2KxOF0sZ1qzZRpdmy6WL5WtThendTPr7cqg3nSxOI3seNq4xbRBn2o7tJmZ4vT0dO+ZT/dsWbfjlbUQFsaeDc+9T/pO7l7f95c3NS7DRBb569aTu9cf2Pr73tDRxMQ/c0yiWJyenp4uTk+LC/KTWFhUtooPRXWlWCzi61JbuX0ReUTyF4vT+H6UNvKGaWkSqFmn0fWi+lRE94D2DusKHBp6KNevX5+ZmVmUh1bnb21mZub69euL8tDs8lvLMQk6Pn4l/OmBrb8/uXt95K9bDUUWPrTlfdLXGzo6PT1dEH8K04XpaWlVXCsoT3KpuKlQkAsKyNaC3GxaTlCQK0upxGpqhelppbQML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QGAIDtAZEBAGB7QGQAANgeEBkAALYHRAYAgO0BkQEAYHtAZAAA2B4QGQAAtgdEBgCA7QGRAQBge0BkAADYHhAZAAC2B0QGAIDtAZEBAGB7QGQAANgeEBkAALYHRAYAgO0xEtn/B42yK3dCVbSzAAAAAElFTkSuQmCC" alt="" />

Demo

Code html:

 <div class="wrap-dialog hide">
<div class="dialog">
<div class="dialog-header">
<span class="dialog-title">删除确认</span>
</div>
<div class="dialog-body">
<span class="dialog-message">你确认删除此条信息?</span>
</div>
<div class="dialog-footer">
<input type="button" class="btn" id="confirm" value="确认" />
<input type="button" class="btn ml50" id="cancel" value="取消" />
</div>
</div>
</div>

Code javascript:

 <script>
$(document).ready(function(){
console.log("jquery ...");
$('#remove').click(function(){
var message = "你确认删除此条信息??";
dialogBox(message,
function () {
console.log("confirmed");
// do something
},
function(){
console.log("canceled");
// do something
}
);
}); }); function dialogBox(message, yesCallback, noCallback){
if(message){
$('.dialog-message').html(message);
}
// 显示遮罩和对话框
$('.wrap-dialog').removeClass("hide");
// 确定按钮
$('#confirm').click(function(){
$('.wrap-dialog').addClass("hide");
yesCallback();
});
// 取消按钮
$('#cancel').click(function(){
$('.wrap-dialog').addClass("hide");
noCallback();
});
}
</script>

完整代码:

 <!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>js confirm弹出框自定义样式</title>
<style>
html,body {
margin: 0;
padding: 0;
font-family: "Microsoft YaHei";
}
.wrap-dialog {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-size: 16px;
text-align: center;
background-color: rgba(0, 0, 0, .4);
z-index: 999;
}
.dialog {
position: relative;
margin: 15% auto;
width: 300px;
background-color: #FFFFFF;
}
.dialog .dialog-header {
height: 20px;
padding: 10px;
background-color: lightskyblue;
}
.dialog .dialog-body {
height: 30px;
padding: 20px;
}
.dialog .dialog-footer {
padding: 8px;
background-color: whitesmoke;
}
.btn {
width: 70px;
padding: 2px;
}
.hide {
display: none;
}
.ml50 {
margin-left: 50px;
}
</style>
</head>
<body >
<input type="button" value="删除" class="btn ml50" id="remove">
<div class="wrap-dialog hide">
<div class="dialog">
<div class="dialog-header">
<span class="dialog-title">删除确认</span>
</div>
<div class="dialog-body">
<span class="dialog-message">你确认删除此条信息?</span>
</div>
<div class="dialog-footer">
<input type="button" class="btn" id="confirm" value="确认" />
<input type="button" class="btn ml50" id="cancel" value="取消" />
</div>
</div>
</div>
</body>
<script src="http://cdn.bootcss.com/jquery/2.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
console.log("jquery ...");
$('#remove').click(function(){
var message = "你确认删除此条信息??";
dialogBox(message,
function () {
console.log("confirmed");
// do something
},
function(){
console.log("canceled");
// do something
}
);
}); }); function dialogBox(message, yesCallback, noCallback){
if(message){
$('.dialog-message').html(message);
}
// 显示遮罩和对话框
$('.wrap-dialog').removeClass("hide");
// 确定按钮
$('#confirm').click(function(){
$('.wrap-dialog').addClass("hide");
yesCallback();
});
// 取消按钮
$('#cancel').click(function(){
$('.wrap-dialog').addClass("hide");
noCallback();
});
}
</script>
</html>

JavaScript confirm 自定义风格及功能实现的更多相关文章

  1. javascript生成自定义的arcgis simpletoolbar

    javascript生成自定义的arcgis simpletoolbar 最近在学习ARCGIS for Javascript过程中,在ESRI的在线帮助上看见了这样一个示例,查看源码后,觉得左侧工具 ...

  2. javascript创建自定义对象和prototype

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. jQuery插件AjaxFileUpload文件上传实现Javascript多文件上传功能

     Ajax file upload plugin是一个功能强大的文件上传jQuery插件,可自定义链接.或其它元素庖代传统的file表单上传结果,可实现Ajax动态提示文件上传 过程,同时支撑多文 ...

  4. 详解javascript实现自定义事件

    这篇文章主要为大家介绍了javascript实现自定义事件的方法,自定义事件,顾名思义,就是自己定义事件类型,自己定义事件处理函数,javascript如何实现自定义事件,需要了解的朋友可以参考下 我 ...

  5. javaScript语法和风格的检查工具

    一.JSLint. JSHint. JSCS. ESLint 1.JSLint是由Douglas Crockford开发的,可能是最早的JavaScript Lint工具.JSLint定义了一组编码约 ...

  6. 齐博x1如何开启自定义标签模板功能

    为安全起见,同时也为了避免用户随意添加风格导致默认模板不协调,系统默认关闭了类似V系列的自定义修改模板功能.如下图所示,默认是关闭的 你如果需要启用的话,把下面的代码,参考下图导进去后,就可以增加一个 ...

  7. sql server实现自定义分割月功能

    本文目录列表: 1.为何出现自定义分割月需求 2.sql server实现自定义分割月功能 3.测试验证效果 4.总结语 5.参考清单列表   1.为何出现自定义分割月的需求   今天梳理一个平台的所 ...

  8. iOS Webview 实现修改javascript confirm 和 alert

    贴代码: @interface UIWebView (JavaScriptAlert) -(void) webView:(UIWebView *)sender runJavaScriptAlertPa ...

  9. javascript confirm()函数的用法

    javascript confirm()函数的用法 confirm():确认消息对话框.用于允许用户做选择的动作.弹出的对话框中包含一确定按钮和一取消按钮. confirm(str) 参数说明: st ...

随机推荐

  1. 使用PowerShell读取SharePoint里列表的内容

    1. 在https://www.microsoft.com/en-us/download/details.aspx?id=42038这里下载SharePoint Online Client Compo ...

  2. jQuery File Upload 单页面多实例的实现

    jQuery File Upload 的 GitHub 地址:https://github.com/blueimp/jQuery-File-Upload 插件描述:jQuery File Upload ...

  3. 多线程编程-工具篇-BlockingQueue

    在新增的Concurrent包中,BlockingQueue很好的解决了多线程中,如何高效安全"传输"数据的问题.通过这些高效并且线程安全的队列类,为我们快速搭建高质量的多线程程序 ...

  4. JavaScript第一天 改变DIV的样式

    onmouseover 当鼠标移到这个对象之上时响应 onmouseout 当鼠标移出这个对象之上时响应 document.getElementById('id')   获取id的元素并可以做一些操作 ...

  5. [1]IP地址查询

    今天起开始玩百度APIStore里面的免费API.以前用过的有12306的:数据.接口,有时间整理出来,12306的有点乱就是了.还有扇贝以及有道的API,之前用在留言板里自动翻译,公司用过百度地图以 ...

  6. jquery 给指定li添加制定的css样式

    $("ul li").eq(1).css({"color":"red"}); //第二个li $("ul li").eq ...

  7. NSInternalInconsistencyException

    2016-09-10 12:48:13.281 Friend[92304:1843372] *** Terminating app due to uncaught exception 'NSInter ...

  8. 来杯Caffe——在ubuntu下安装Caffe框架并测试

    Caffe是一种深度学习框架...blablabla...... Caffe要在ubuntu下安装 1. 安装依赖 sudo apt-get install libatlas-base-dev sud ...

  9. RestTemplate配置

    什么是RestTemplate? RestTemplate是Spring提供的用于访问Rest服务的客户端,RestTemplate提供了多种便捷访问远程Http服务的方法,能够大大提高客户端的编写效 ...

  10. SELENIUM2 使用JavascriptExecutor在页面Javascipt执行

    目的: 1. 执行一段JS,来改变HTML2. 一些非标准控件无法用selenium2的API时,可以执行JS的办法来取代 主要操作:JavascriptExecutor j = (Javascrip ...