日期:2014-05-16  浏览次数:20481 次

简单问题,快来抢分啊
父窗体用 <a   href   =   'b.htm '   target   =   '_blank '> </a> 打开子窗体b
问如何在b中实现,关闭子窗口,刷新父窗口

一经测试成功,马上揭帖。抢吧~


------解决方案--------------------
更新记录后关闭子窗口并刷新父窗口的JS
以ASP代码为例,使用一个条件句决定代码执行顺序,你可以将它放在记录更新之后(将转向目标后加上条件参数,例如转向目标为post.asp?action=go)


<% if Request( "action ")= "go " then %>

<script language= "JavaScript ">

<!--

function refreshParent() {

window.opener.location.href = window.opener.location.href;

if (window.opener.progressWindow)

window.opener.progressWindow.close();

window.close();

}

//-->

</script>

<body bgcolor= "#f5f5f3 " leftmargin= "0 " topmargin= "0 " onLoad= "refreshParent() "> <%end if%>


------解决方案--------------------
b.htm窗体

<script>
this.opener.location.reload();
this.close();
</script>