弹窗返回值

父页
vReturnValue = window.showModalDialog(sURL,window,'')
子页

opener.document.getElementById("test").value="返回值"

 

参数传递 通过vArguments来传递参数,类型不限制,对于字符串类型,最大为4096个字符,也可以传递对象,例如:

parent.htm
<script>
window.showModalDialog("sun.htm","传递进去的参数","help:no;scroll:no");
</script>
sun.htm
<script>
alert("传来的参数:" + window.dialogArguments);
</script>

 

返回值 通过window.returnValue向打开对话框的窗口返回信息,也可以是对象。例如:

parent.htm
<script>
result=window.showModalDialog("son.htm","","help:no;scroll:no");
alert(result);
</script>
son.htm
<script>
window.returnValue="这里存放返回的结果";
</script>

posted on 2009-07-29 16:03  石牌村夫  阅读(346)  评论(0)    收藏  举报