父页面:
1 var obj = new Object(); 2 obj.name="name"; 3 var rtnValue=window.showModalDialog("child.aspx",obj,"dialogWidth:500px;dialogHeight:300px;status:no;scrollbars=yes;help:no"); 4 if(rtnValue=="ok"){ 5 window.location.reload();//刷新父页面 6 }
子页面(两种方式):
1 ①前台(.aspx): 2 <script type="text/javascript"> 3 var obj = window.dialogArguments;//获取父页面传值(alert("您传递的参数为:" + obj.name)) 4 window.returnValue="ok";//向父页面传值 5 close();//关闭子页面 6 </script> 7 ②后台(.aspx.cs): 8 Response.Write("<script type=‘text/javascript‘>window.returnValue=‘ok‘;close();</script>");