现在的位置: 首页 > 综合 > 正文

子窗口刷新父窗口然后关闭

2012年12月16日 ⁄ 综合 ⁄ 共 765字 ⁄ 字号 评论关闭

页面a里有个按钮点上就用window.showModalDialog(“b.html”)打开页面b.html这个页面里有个提交form点提交以后,就在父页A里增加一条记录,算新父目录然后父目录里能看见新增加的记录,关闭子页面,怎么实现,好像就是子窗口刷新父窗口然后关闭

1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL=location.href
这几个都可以刷新
比如:父窗口
<a href="javascript:void(0)" onclick="window.open('child.html','child','width=400,height=300,left=200,top=200');">打开子窗口</a>

子窗口
<script language="JavaScript" type="text/javascript">
<!--
function refreshParent() {
window.opener.location.href = window.opener.location.href;
if (window.opener.progressWindow)
{
window.opener.progressWindow.close();
}
window.close();
} //-->
</script>

<a href="javascript:void(0)" onclick="refreshParent()">刷新父窗口并关闭当前窗口</a>

抱歉!评论已关闭.