window.showModalDialog和window.open关闭子页面时刷新父页面

来源:百度文库 编辑:神马文学网 时间:2024/04/27 13:43:00
父窗体打开页面的javascript
function GoToPage(id)
{
var title="title";
var url="xxxxx.aspx?ID="+id+"&Radom="+Math.random();;
var Width="700";
var Height="600";
var arguemnts = new Object();
arguemnts.window = window;
if (document.all&&window.print)
{
window.showModalDialog(url,arguemnts,"dialogWidth:" + Width + "px;dialogHeight:" + Height + "px;center:yes;status:no;scroll:yes;help:no;");
}
else
{
window.open(url,"","width=" + Width + "px,height=" + Height + "px,resizable=1,scrollbars=1");
}
}
子页面执行代码后:
Response.Write("window.dialogArguments.window.location = window.dialogArguments.window.location;");
Response.Write("");
如果是window.open打开的:
Response.Write("window.opener.location.reload();") ;
Response.Write("window.opener=null;window.close();");