说明:下列代码中:红色标记的window.returnValue即为返回的值
//弹出窗口,下拉框选择条件
function openWinForSel(obj,swidth,sheight){
var params = obj.parentNode.childNodes[0].value;
var selValue = showModalDialog("<%=request.getContextPath()%>/pages/dynamic/define/openWindowForSel.jsp?params="+params,obj,"dialogWidth:"+300+"px;dialogHeight:"+300+"px;help:no;scroll:auto;status:no");
try{
if(selValue != 'undefined' && selValue.indexOf('@@')!= -1)
obj.parentNode.childNodes[0].value = selValue;
}catch(Exception){
//alert('test');
}
//alert(obj.parentNode.childNodes[0].value);
}
获取值的JS:
//var obj = window.dialogArguments;
function getSelValue() {
var params = getParam('selList');
//如果是用户自定义则返回如下
if(params!="" && params!=null) {
var inputParam = "def@@" + params;
window.returnValue = inputParam;
window.close();
} else {
//如果是用户选择则返回如下
var items = document.getElementsByName('selRadio');
for(var i=0; i<items.length; i++) {
if(items[i].checked) {
var itemValue = items[i].value;
window.returnValue = itemValue;
window.close();
}
}
}
}