popup控件代码示例

1.jsp页面input框中的代码

<td class="value">
<input name="demos[0].id" type="hidden" value="" />
<input onclick="inputClick(this,'demos[0]','user_msg');" placeholder="点击选择用户" name="demos[0].name" type="text" style="cursor: pointer;" class="inputxt" value="">
</td>

2.对应的js部分的代码

function inputClick(obj, rowTag, code) {
if (rowTag == null || code == "") {
alert("popup参数配置不全");
return;
}
var inputClickUrl = basePath + "/cgReportController.do?popup&id=" + code;
if (typeof (windowapi) == 'undefined') {//页面弹出popup
$.dialog({
content : "url:" + inputClickUrl,
zIndex : getzIndex(),
lock : true,
title : "选择",
width : 800,
height : 400,
cache : false,
ok : function() {
iframe = this.iframe.contentWindow;
var selected = iframe.getSelectRows();//重要,此处获取行数据
return setMultiVlaue(obj,rowTag,selected);
},
cancelVal : '关闭',
cancel : true//为true等价于function(){}
});
} else {//popup内弹出popup
$.dialog({
content : "url:" + inputClickUrl,
zIndex : getzIndex(),
lock : true,
title : "选择",
width : 800,
height : 400,
parent : windowapi,//设置弹出popup的openner
cache : false,
ok : function() {
iframe = this.iframe.contentWindow;
var selected = iframe.getSelectRows();//重要,此处获取行数据
return setMultiVlaue(obj,rowTag,selected);
},
cancelVal : '关闭',
cancel : true//为true等价于function(){}
});
}
}

原文地址:https://www.cnblogs.com/xujiating/p/7569392.html