如何在关闭弹出窗口刷新父页面? [英] How to reload parent page on closing PopUp window?
本文介绍了如何在关闭弹出窗口刷新父页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个母版页..上一个LinkButton的条款和条件,当它使用的点击会显示弹出窗口usingthis code
I have a linkbutton "terms and conditions "on a master page.. when use clicks on it a popup window is displayed usingthis code
Dim myScript As String
myScript = "<script>window.open('Terms.aspx?',null,'height=750, width=1024,status= no,resizable= no, scrollbars=yes,toolbar=no,location=no,menubar=no'); </script>"
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "pop", myScript, False)
我有弹出窗口页面,在那里我将结束这个弹出
I have a accept button on pop up window page on which i am closing this pop up
ClientScript.RegisterStartupScript(GetType(Page), "closePage", "window.close();", True)
问题是我要刷新的父窗口一旦这个弹出窗口关闭。我怎样才能做到这一点?
这并没有工作,<一个href=\"http://stackoverflow.com/questions/11398356/refreshing-parent-window-after-closing-popup\">Refreshing关闭弹出后父窗口
更新
<div style="padding:5px 0;">
<asp:Button ID="btnAccept" runat="server" Text="Accept" OnClientClick="Refresh()" style="HEIGHT: 19px;background: #C0003B;color: white; " /> <asp:Button ID="btnReject" runat="server" Text="Reject" OnClientClick="Refresh()" style="HEIGHT: 19px;background: #C0003B;color: white;"/>
</div>
function Refresh() {
return confirm('Are you sure?');
window.onunload = refreshParent;
function refreshParent() {
window.opener.location.reload();
}
}
推荐答案
您可以使用window.opener访问父窗口,所以,写类似的子窗口如下:
You can access parent window using 'window.opener', so, write something like the following in the child window:
onunload="window.opener.location.reload();"
或使用本
<script>
window.onunload = refreshParent;
function refreshParent() {
var retVal = confirm("Are you sure ?");
if( retVal == true ){
window.opener.location.reload();
else
return false;
}
</script>
这篇关于如何在关闭弹出窗口刷新父页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文