多次使用确认弹窗

 <!--START 确认收货-->
<div class="popout-boxbg out" id="delivery_goods">
<div class="popout-box-ios">
<div class="header center font-size-16" name="confirm_dialog_title">随便编一点 </div>
<div class="content c-gray-dark font-size-14" name="confirm_dialog_content">确认收货后,订单交易完成。 </div>
<div class="action-container">
<button class="js-ok" name="confirm_dialog_confirmbtn">确认收货</button>
<button class="js-cancel" name="confirm_dialog_cancelbtn">取消</button>
</div>
</div>
</div>
<!--确认弹窗对象-->
<script>
var confirmDialogModel = {
//传入主题,内容,确认按钮字,取消按钮字,确认按钮事件,取消事件事件,确认事件参数数组,取消事件参数数组
Init: function (title, content, confirmText, cancelText, confirmFunc, cancelFunc, confirmParam, cancelParam) {
//设置数据
this.InitData(title, content, confirmText, cancelText, confirmFunc, cancelFunc, confirmParam, cancelParam);
this.EditModal();
$("#" + this.ID).addClass("in");
},
ID: "delivery_goods",
Title: "确认弹窗",
Content: "确认后,事件完成",
ConfirmButtonFunc: function () { alert("确认点击") },
ConfirmButtonText: "确认",
CancelButtonFunc: function () { $("#" + this.ID).removeClass("in"); },
CancelButtonText: "取消",
ConfirmParam: {},//确认传递的参数值
CancelParam: {},//取消传递的参数值
InitData: function (title, content, confirmText, cancelText, confirmFunc, cancelFunc, confirmParam, cancelParam) {
if (title != undefined) {
this.Title = title;
}
else {
this.Title = "确认";
}
if (content != undefined) {
this.Content = content;
}
else {
this.Content = "确认后,事件完成。";
}
if (confirmText != undefined) {
this.ConfirmButtonText = confirmText;
}
else {
this.ConfirmButtonText = "确认";
}
if (cancelText != undefined && confirmText != "") {
this.CancelButtonText = cancelText;
}
else {
this.CancelButtonText = "取消";
}
if (confirmFunc != undefined && typeof confirmFunc == "function") {
this.ConfirmButtonFunc = confirmFunc;
}
else {
this.ConfirmButtonFunc = function () {
alert("确认按钮点击");
$("#" + this.ID).removeClass("in");
}
}
if (cancelFunc != undefined && typeof confirmFunc == "function") {
this.CancelButtonFunc = cancelFunc;
}
else {
this.CancelButtonFunc = function () {
alert("取消按钮点击");
$("#" + this.ID).removeClass("in");
}
}
if (confirmParam == undefined) {
this.ConfirmParam = {};
}
else {
this.ConfirmParam = confirmParam;
}
if (cancelParam == undefined) {
this.CancelParam = {};
}
else {
this.CancelParam = cancelParam;
}
},
EditModal: function () {
var obj = $("#" + this.ID);
$(obj).find("[name=confirm_dialog_title]").text(this.Title);
$(obj).find("[name=confirm_dialog_content]").text(this.Content);
$(obj).find("[name=confirm_dialog_confirmbtn]").text(this.ConfirmButtonText);
$(obj).find("[name=confirm_dialog_cancelbtn]").text(this.CancelButtonText);
$(obj).find("[name=confirm_dialog_confirmbtn]").off("click");
$(obj).find("[name=confirm_dialog_confirmbtn]").on("click", this.ConfirmButtonFunc);
$(obj).find("[name=confirm_dialog_cancelbtn]").off("click");
$(obj).find("[name=confirm_dialog_cancelbtn]").on("click", this.CancelButtonFunc);
},
CloseModal: function () {
$("#" + this.ID).removeClass("in");
}
};
</script>
<!--START 收货按钮点击-->
<script>
function receipt(id) {
confirmDialogModel.Init("确认收货", "确认收货后,订单交易完成。", "确认收货", "取消", confirmReceipt, undefined, { "id": id }, {});
}
</script>
<!--START 确认收货-->

弹窗对象设置

其中如果想放html类型的内容,如<span style="color:red">主题名</span>,那替换的时候就用$(obj).html("<span style="color:red">主题名</span>")。

主要是嫌多个弹窗,都要加一个html,还不如用一个,反正每次也只允许弹一个。忘记说了,这个需要添加浮层的,就是不允许后面的html点击。至于样式,自由发挥吧

<div class="popout-boxbg out" id="delivery_goods">
<div class="popout-box-ios">
<div class="header center font-size-16" name="confirm_dialog_title">随便编一点 </div>
<div class="content c-gray-dark font-size-14" name="confirm_dialog_content">确认收货后,订单交易完成。 </div>
<div class="action-container">
<button class="js-ok" name="confirm_dialog_confirmbtn">确认收货</button>
<button class="js-cancel" name="confirm_dialog_cancelbtn">取消</button>
</div>
</div>
</div>

JS动态设置确认弹窗的更多相关文章

  1. js动态设置padding-top遇到的坑

    我想通过js动态设置元素padding-top的百分比值:以下几种都是无法设置成功的: // setAttribute设置padding-top并且转换为百分比 imageBox.setAttribu ...

  2. Dynamic CRM 2013学习笔记(二十八)用JS动态设置字段的change事件、必填、禁用以及可见

    我们知道通过界面设置字段的change事件,是否是必填,是否可见非常容易.但有时我们需要动态地根据某些条件来设置,这时有需要通过js来动态地控制了. 下面分别介绍如何用js来动态设置.   一.动态设 ...

  3. js动态设置窗体位置

    1设置登录框的js,动态设置高度等 <script> $(document).ready(function () { $() / + "px"); $("in ...

  4. js动态设置根元素的rem方案

    方案需求: rem 单位在做移动端的h5开发的时候是最经常使用的单位.为解决自适应的问题,我们需要动态的给文档的根节点添加font-size 值. 使用mediaquery 可以解决这个问题,但是每一 ...

  5. js动态设置输入框字体/颜色

    动态设置文本框颜色: 主要是利用javascript中的触发事件onfocus和onblur <script language="javascript" type=" ...

  6. JS动态设置css的几种方式

    1. 直接设置style的属性  某些情况用这个设置 !important值无效 如果属性有'-'号,就写成驼峰的形式(如textAlign)  如果想保留 - 号,就中括号的形式  element. ...

  7. js 动态设置键值对数组 ,类似于 java 的Map 类型

    1.前言 我想设置一个数据  var json = {a1 :1  , a2 :2  , a3 :3  .....} 这样的动态数据 ,怎么写呢? 2.正确写法 var json = []; for ...

  8. Js动态设置rem来实现移动端字体的自适应

    //设置根元素字体 var win = window, doc = document; function setFontSize() { var winWidth = $(window).width( ...

  9. Js 动态设置DIV日期信息

    HTML代码如下: <div  id="time"> 2013年12月20日 14:49:02 星期五 </div> JS代码如下: window.onlo ...

随机推荐

  1. OpenGL光照设置

    一.设置光源 (1)光源的种类 环境光 环境光是一种无处不在的光.环境光源放出的光线被认为来自任何方向.因此,当你仅为场景指定环境光时,所有的物体无论法向量如何,都将表现为同样的明暗程度. 点光源 由 ...

  2. linux 日志查询

    tail -n 400 logname | grep "AAA" grep 简单使用 1.把要查询的行写到文本里面去: grep WXCP IC.NotifyIndexServer ...

  3. BIO、NIO、AIO系列一:NIO

    一.几个基本概念 1.同步.异步.阻塞.非阻塞 同步:用户触发IO操作,你发起了请求就得等着对方给你返回结果,你不能走,针对调用方的,你发起了请求你等 异步:触发触发了IO操作,即发起了请求以后可以做 ...

  4. Spring JDBC SqlUpdate类示例

    org.springframework.jdbc.object.SqlUpdate类提供了表示SQL更新的可重用操作对象. 使用到的 Student 表的结构如下 - CREATE TABLE Stu ...

  5. Spring JDBC查询数据

    以下示例将展示如何使用Spring jdbc进行查询数据记录,将从student表中查询记录. 语法: String selectQuery = "select * from student ...

  6. python_不用循环打印1-1000

    题目:屏幕上打印1-1000这1000个数, 不许使用循环语句/条件语句,不许使用?:算符. 不许在源代码中用列举输出语句的办法傻打,比如一千个print语句不行,不再赘述其他傻打行为, 大家都能领会 ...

  7. C# 异常和异常处理

    C# 语言的异常处理功能可帮助您处理程序运行时出现的任何意外或异常情况. 异常处理使用 try.catch 和 finally 关键字尝试某些操作,以处理失败情况,尽管这些操作有可能失败,但如果您确定 ...

  8. 关于TensorFlow多种安装方式

    Tensorflow的官网其实给出了很详细的安装教程,细分包括: Pip install: Install TensorFlow on your machine, possibly upgrading ...

  9. 消息中间件activemq-5.13.0安全验证配置

    activemq分为控制端和客户端,下面分别介绍安全认证配置方法. 1.控制端安全配置 (1). ActiveMQ目录conf下找到jetty.xml: <bean id="secur ...

  10. 1. BeeGo 介绍与项目的创建,启动

    简介 BeeGo是一个快速开发Go而应用的HTTP框架,他可以用来快速开发API,web以及后端服务等各种应用,是一个restful 的框架,主要涉及灵感来源于tornado,sinatr和flask ...