可以通过window.returnValue向打开对话框的窗口返回信息,当然也可以是对象。例如:
------------------------------
a.htm
<script>
str =window.showModalDialog("b.htm","dialogWidth=200px;dialogHeight=100px");
alert(str);
</script>
b.htm
<script>
window.returnValue="要返回A页面的值";
</script>
------------------------------
a.htm
<script>
str =window.showModalDialog("b.htm","dialogWidth=200px;dialogHeight=100px");
alert(str);
</script>
b.htm
<script>
window.returnValue="要返回A页面的值";
</script>
/////////////////////
<script>
function test()
{
showModalDialog("b.htm",window,"dialogWidth=300px;dialogHeight=250px");
}
function getValue(str)
{
document.all.txt.value = str;
}
</script>
<INPUT type="button" onClick="test()" value="test">
<input type="text" id="txt">b.htm
/////////////////////////////////
<SCRIPT language="javascript">
function test()
{
dialogArguments.getValue(document.all.txt.value);
self.close();
}
</SCRIPT>
<BODY>
<INPUT type="button" value="test" onClick="test()">
<input type="text" id="txt"><br>输入内容按test按钮
</BODY>