在不使用window.showModalDialog 的情况下用 window.open方式 向父窗口返回值。
例:页面AAA.htm 用 window.open方式弹出页面 BBB.htm 。
在页面BBB.htm上选择一个值,确定关闭窗口后将选择的这个值返回到父窗口AAA.htm。
AAA.htm得到返回的值后,给本页面上的文本框赋值。
AAA.htm
例:页面AAA.htm 用 window.open方式弹出页面 BBB.htm 。
在页面BBB.htm上选择一个值,确定关闭窗口后将选择的这个值返回到父窗口AAA.htm。
AAA.htm得到返回的值后,给本页面上的文本框赋值。
AAA.htm
<input id="test" name="test" />
BBB.htm
<script language="javascript">
function myclose(){
window.opener.document.getElementById("test").value=document.getElementById('mytest').options[document.getElementById("mytest").selectedIndex ].value;
window.close();
}
</script>
<select id="mytest" name="mytest">
<option value="1" selected="selected">text1</option>
<option value="2">text2</option>
</select>
<input type="button" οnclick="myclose()" />