function OpenBootStrapModal(url, iframeId, dlgTitle, dlgWidth, dlgHeight, dlgIcon, showBtns, okBtnFunc, okBtnFuncArgs, dlgClosedFunc, divId,closeBtnColor,showCloseBtn) { ///使用EasyUiDialog打开一个页面 ///页面链接 ///嵌套url页面的iframe的id,在okBtnFunc中,可以通过document.getElementById('eudlgframe').contentWindow获取该页面,然后直接调用该页面的方法,比如获取选中值 ///Dialog标题 ///Dialog宽度 ///Dialog高度 ///Dialog图标,必须是一个样式class ///Dialog下方是否显示“确定”“取消”按钮,如果显示,则后面的okBtnFunc参数要填写 ///点击“确定”按钮调用的方法 ///okBtnFunc方法使用的参数 ///窗体关闭调用的方法(注意:此方法中不能再调用dialog中页面的内容) ///是否显示关闭按钮 var dlg = $('#bootStrapdlg'); var isTheFirst; if (divId != null && divId != "") dlg = $('#' + divId); if (dlg.length == 0) { isTheFirst = true; var divDom = $(""); //divDom.attr("id", "bootStrapdlg"); if (divId != null && divId != "") divDom.attr("id", divId); else divDom.attr("id", "bootStrapdlg"); $(document.body).append(divDom); if (divId != null && divId != "") dlg = $('#' + divId); else dlg = $('#bootStrapdlg'); } if (dlg.length == 1) { dlg.children().remove(); dlg.empty(); dlg.html(""); } var modalDialog = $(""); modalDialog.width(dlgWidth).height(dlgHeight); //容器 var modalContent = $(""); modalDialog.append(modalContent); //标题 var modalHead = $(""); if (showCloseBtn == null) showCloseBtn = true; //关闭按钮 if(showCloseBtn == true) var btnClose = $(""); if (closeBtnColor && closeBtnColor != "") btnClose = $(""); //标题 var titleHead = $(""); titleHead.text(dlgTitle); modalHead.append(btnClose); modalHead.append(titleHead); //添加标题块 modalContent.append(modalHead); //body块 var modalBody = $(""); var iframeWidth = dlgWidth - 45; var iFrame = $(""); iFrame.attr("id", iframeId); iFrame.attr("name", iframeId); iFrame.attr("src", url); iFrame.attr("src", url); iFrame.css("width", iframeWidth + "px").css("height", dlgHeight + "px").css("border", "0px"); modalBody.append(iFrame); //添加内容块 modalContent.append(modalBody); //结束 dlg.append(modalDialog); if (typeof window.doCloseDialog != "function") { window.doCloseDialog = function () { dlg.modal('hide'); }; // 当弹出框未获得焦点时触发 $(document).bind("keyup", function (e) { e = e || window.event; var key = e.keyCode || e.which || e.charCode; if (key == 27) { if (typeof doCloseDialog === 'function') { doCloseDialog.call(); } } }); } if (showBtns && okBtnFunc) { var modalFooter = $(""); var footerClose = $(""); footerClose.click(function () { dlg.modal('hide'); }); var footerOK = $(""); footerOK.click(function () { if (okBtnFunc(okBtnFuncArgs) == false) { return; } dlg.modal('hide'); }); //添加确定和关闭按钮 modalFooter.append(footerOK); modalFooter.append(footerClose); //添加底层脚本 modalContent.append(modalFooter); } //关闭事件 dlg.off('hide.bs.modal'); dlg.on('hide.bs.modal', function () { /*防止缓存,切换页面不能显示问题*/ dlg.remove(); // 关闭时清空edit状态为add dlg.find("iframe").attr('src', ''); if (dlgClosedFunc) { dlgClosedFunc(); } }); dlg.modal().show(); return "bootStrapdlg"; } function OpenBootStrapModalByContent(jsUrl,jsfunction,divID, dlgTitle, dlgWidth, dlgHeight, dlgIcon, showBtns, okBtnFunc, okBtnFuncArgs, dlgClosedFunc, divId, closeBtnColor, showCloseBtn) { ///使用EasyUiDialog打开一个页面 ///页面链接 ///嵌套url页面的iframe的id,在okBtnFunc中,可以通过document.getElementById('eudlgframe').contentWindow获取该页面,然后直接调用该页面的方法,比如获取选中值 ///Dialog标题 ///Dialog宽度 ///Dialog高度 ///Dialog图标,必须是一个样式class ///Dialog下方是否显示“确定”“取消”按钮,如果显示,则后面的okBtnFunc参数要填写 ///点击“确定”按钮调用的方法 ///okBtnFunc方法使用的参数 ///窗体关闭调用的方法(注意:此方法中不能再调用dialog中页面的内容) ///是否显示关闭按钮 var dlg = $('#bootStrapdlg'); var isTheFirst; if (divId != null && divId != "") dlg = $('#' + divId); if (dlg.length == 0) { isTheFirst = true; var divDom = $(""); //divDom.attr("id", "bootStrapdlg"); if (divId != null && divId != "") divDom.attr("id", divId); else divDom.attr("id", "bootStrapdlg"); $(document.body).append(divDom); if (divId != null && divId != "") dlg = $('#' + divId); else dlg = $('#bootStrapdlg'); } if (dlg.length == 1) { dlg.children().remove(); dlg.empty(); dlg.html(""); } var modalDialog = $(""); modalDialog.width(dlgWidth).height(dlgHeight); //容器 var modalContent = $(""); modalDialog.append(modalContent); //标题 var modalHead = $(""); if (showCloseBtn == null) showCloseBtn = true; //关闭按钮 if (showCloseBtn == true) var btnClose = $(""); if (closeBtnColor && closeBtnColor != "") btnClose = $(""); //标题 var titleHead = $(""); titleHead.text(dlgTitle); modalHead.append(btnClose); modalHead.append(titleHead); //添加标题块 modalContent.append(modalHead); // modalHead.append("") //body块 var modalBody = $(""); var iframeWidth = dlgWidth - 45; /*var iFrame = $(""); iFrame.attr("id", iframeId); iFrame.attr("name", iframeId); iFrame.attr("src", url); iFrame.attr("src", url); iFrame.css("width", iframeWidth + "px").css("height", dlgHeight + "px").css("border", "0px");*/ modalBody.append("
"); //添加内容块 modalContent.append(modalBody); dlg.append(modalDialog); if (typeof window.doCloseDialog != "function") { window.doCloseDialog = function () { dlg.modal('hide'); }; // 当弹出框未获得焦点时触发 $(document).bind("keyup", function (e) { e = e || window.event; var key = e.keyCode || e.which || e.charCode; if (key == 27) { if (typeof doCloseDialog === 'function') { doCloseDialog.call(); } } }); } if (showBtns && okBtnFunc) { var modalFooter = $(""); var footerClose = $(""); footerClose.click(function () { dlg.modal('hide'); }); var footerOK = $(""); footerOK.click(function () { if (okBtnFunc(okBtnFuncArgs) == false) { return; } dlg.modal('hide'); }); //添加确定和关闭按钮 modalFooter.append(footerOK); modalFooter.append(footerClose); //添加底层脚本 modalContent.append(modalFooter); } cceval(jsfunction); //关闭事件 dlg.off('hide.bs.modal'); dlg.on('hide.bs.modal', function () { /*防止缓存,切换页面不能显示问题*/ dlg.remove(); // 关闭时清空edit状态为add dlg.find("iframe").attr('src', ''); if (dlgClosedFunc) { dlgClosedFunc(); } }); dlg.modal().show(); return "bootStrapdlg"; } //关闭弹出窗 function CloseBootstrapDialog() { $('#bootStrapdlg').modal('hide'); }