弹出窗体返回参数给父窗体方法:
1:弹出窗体 (phone_info.jsp)
function sel_phone() {
window.returnValue = postid.value+"*"+cityid.value ;
window.close();
}
postid:<select id=postid >
<option selected="selected"> --select postid-- </option>
<optionvalue="001">001</option>
<option value="002">002</option>
</select>
city:<select id=cityid >
<option selected="selected"> --select city-- </option>
<option value="001">001</option>
<option value="002">002</option>
</select>
<input type="button" name="button" value="button">
2:父窗体
function phoneInfo() {
var gysArr = window.showModalDialog('phone_info.jsp, "new","dialogHeight:50px;dialogWidth:250px;edge:Raised;center:Yes;help:No;resizable:no;status:no;");
if (gysArr!= null){
var ss;
ss=gysArr.split("*");
document.getElementById("postid").value=ss[0];
document.getElementById("cityid").value=ss[1];
}
}
<input type="button" value="弹出窗体"οnclick="phoneInfo();"><br>
post:<input type="text" id="postid" name="postid"><br>
city:<input type="text" id="cityid" name="cityid">
ok,就这样!