如何在父页面的子窗口关闭时刷新其父页面?
发布于 2011-02-21 19:35:04
在这个孩子中,你会有一个类似这样的脚本。
<script type="text/javascript">
function refreshParent() {
//re-set the parent url to refresh
//window.opener references the parent page
window.opener.location.href = window.opener.location.href;
}
</script>
[...]
// the onunload event fires when the child page is closed
<body onunload=refreshParent(); >发布于 2011-02-21 19:41:08
尝试使用子窗口中的给定代码:
ASPX:
<asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="butColSmall"
onclick="btnCancel_Click" />ASPX.CS
protected void btnCancel_Click(object sender, EventArgs e)
{
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "sCancel", "window.opener.location.href = window.opener.location.href;self.close()", true);
}https://stackoverflow.com/questions/5065365
复制相似问题