使用art.dialog需要先引入相关的js文件:
下载地址:https://download.csdn.net/download/liangmengbk/11240599
<script src="jquery-1.4.2.min.js"></script>
<script src="artDialog.js"></script>
<script src="iframeTools.js"></script>
封装方法:
/*artdialog初始配置*/
(function (config) {
config['lock'] = true;
config['fixed'] = true;
config['okVal'] = 'Ok';
config['cancelVal'] = 'Cancel';
// [more..]
})(art.dialog.defaults);
//----------------------------------------------------------------
// 创建时间:: 2013-09-13
// 功能:弹出Html页面
// iframeID:Tab的Iframe的ID
// PopID:弹出框的ID
// HtmlUrl:弹出路径的页面名称
// PopWidth:弹出框宽度
// PopHeight:弹出框高度
// DataMsg:传递到页面的参数
// IsOpCloseFun:bool类型,传递true,执行OpCloseFunction
// ----------------------------------------------------------------
function commonPopHtmlOrAspx(PopID, HtmlUrl, PopWidth, PopHeight, popTitle, DataMsg, IsOpCloseFun) {
try {
$("#TopTable tr").eq(0).removeAttr("style");
$("#CenterTable tr").eq(0).removeAttr("style");
} catch (e) { }
art.dialog.data("dataMsg", DataMsg);
var path = '/' + HtmlUrl;
art.dialog.open(path, {
id: PopID == "" ? "CommonPopID" : PopID,
title: popTitle == "" ? "操作提示" : popTitle,
width: PopWidth == "" ? "auto" : PopWidth,
height: PopHeight == "" ? "auto" : PopHeight,
padding: "40px 50px 0 15px",
close: function () {
var result = art.dialog.data("returnResule");
var arrresult = ((result == null || result == "") ? "|" : result).split('|'); //返回结果必须是带“|”的字符创,第一个参数是返回操作结果,第二个参数是需要返回的数据
art.dialog.data("returnResule", "");
if (arrresult[0] == 'noSession') {
window.location.href = "/";
} else if ((arrresult[0] == 'OpSucceed')) {
OpSuccessFunction(arrresult[1]);
} else if ((arrresult[0] == 'OpError')) {
OpErrorFunction(arrresult[1]);
} else if (IsOpCloseFun) {
OpCloseFunction();
}
}
}, false);
}
使用实例:
commonPopHtmlOrAspx("InvoiceApplyManageFrame", "Common/ChoiceInvoiceOrReceipt.aspx, "500px", "290px", "发票/收据申请", "传递的参数", false);
实例效果图: