<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style>
/* 首页弹出层 */
.confirm-tips{width:100%; height:100%; background:url(apher.png); position:fixed; top:0; z-index:999999999;overflow: auto;}
.confirm-tips-box{width:500px; height:334px; background:#FFF; position:absolute;top:25%;}
.confirm-tips-box h2{display:block; margin-top:50px; text-align:center; font-size:36px; font-weight:normal; color:#3881eb;}
.confirm-tips-box p{font-size:20px; color:#757c8a; text-align:center; display:block; margin-top:36px;}
.autobut a.submissionqx{display:inline-block; width:188px; height:60px; -moz-border-radius:6px; -webkit-border-radius:6px; border-radius:6px; border:1px solid #3881eb; text-align:center; line-height:60px; color:#3881eb; margin:0 auto; margin-top:60px; margin-bottom:50px; margin-left:45px; margin-right:30px;}
.autobut a.submission{display:inline-block; width:188px; height:60px; -moz-border-radius:6px; -webkit-border-radius:6px; border-radius:6px; background:#3881eb; text-align:center; line-height:60px; color:#FFF; margin:0 auto; margin-top:60px; margin-bottom:50px;}
</style>
</head>
<body>
<input id='alter_btn' type='button' value='弹窗确定取消按钮'/>
<span id='msg'></span>
<script>
/**
* 共用弹窗 确定 取消按钮
* eg: option = {
* title:'标题',
* msg:'内容',
* confirm:function(){
* 点击确定执行的方法
* },
* cancel:function(){
* 点击取消执行的方法
* }
* }
* eg: $.confirm_tips(option);
* @param obj
*/
$.confirm_tips = function(obj){
if(obj && obj.msg != ''){
if(!obj.title){
obj.title = '系统提示';
}
var left = parseFloat(($(document).width()-500)/2);
var tips_html = '<div class="confirm-tips confirm-tips-common" >' +
'<div class="confirm-tips-box" style="left:'+left+'px;">\n' +
' <h2>'+obj.title+'</h2>\n' +
' <p style="padding: 0 15px">'+obj.msg+'</p>\n' +
' <div class="autobut">\n' +
' <a href="javascript:;" class="submissionqx confirm-tips-cancelbtn">取消</a>\n' +
' <a href="javascript:;" class="submission confirm-tips-confirmbtn">确定</a>\n' +
' </div>\n' +
' </div></div>';
if($('.confirm-tips-common').length <= 0){
$('body').append(tips_html);
}
$('.confirm-tips-confirmbtn').click(function(){
if(obj.confirm){
obj.confirm();
}
$('.confirm-tips-common').remove();
$('.confirm-tips-confirmbtn').unbind();
})
$('.confirm-tips-cancelbtn').click(function(){
if(obj.cancel){
obj.cancel();
}
$('.confirm-tips-common').remove();
$('.confirm-tips-cancelbtn').unbind();
})
}
} $('#alter_btn').click(function(){
var option = {
title:'标题',
msg:'内容',
confirm:function(){
$('#msg').text('确定');
},
cancel:function(){
$('#msg').text('取消');
}
};
$.confirm_tips(option);
})
</script>
</body>
</html>

最新文章

  1. SAP CRM 使用Javascript触发SAP Server Event
  2. hadoop fs -ls no such file or directory
  3. C#监控USB接口
  4. php setcookie(name, value, expires, path, domain, secure) 参数详解
  5. IE浏览器的兼容模式代码细节解读
  6. 九、Socket之TCP编程
  7. YII 集成jquery
  8. 6.0RMB MP3所看到的……
  9. Java-继承的应用
  10. React与Preact差异之 -- setState
  11. 3分钟利用TurnipBit制作电子时钟
  12. Mybatis源码之Statement处理器BaseStatementHandler(二)
  13. ArrayList的ConcurrentModificationException异常和多线程下的异常
  14. 【转载】C#工具类:FTP操作辅助类FTPHelper
  15. 记一次AngularJs 路由 $stateChangeStart不起作用(细节决定成败)
  16. JQuery基本知识汇总;JQuery常用方法;浅入了解JQuery
  17. webpack 开发环境与生成环境的 配置
  18. 《Head First 设计模式》[02] 观察者模式
  19. Django xadmin引入DjangoUeditor
  20. 【IntelliJ 】IntelliJ IDEA 2017激活码

热门文章

  1. mybatis支持的jdbc类型
  2. webStrorm 简单配置
  3. [问题记录]libpomelo工程调整编译链接错误
  4. February 22 2017 Week 8 Wednesday
  5. MongoDB创建集合、删除集合
  6. 国外优秀JavaScript资源推荐
  7. Charles Proxy v4.1.3 Mac、Win64、Win32破解版
  8. PCA算法的最小平方误差解释
  9. oracle 导出空表问题
  10. AutoLayout对 scrollview的contentSize 和contentOffset属性的影响