这是我之前的问题。如何在关闭弹出窗口时重新加载父页面?
我尝试了多种方法,但无法使其工作。有时无论我选择什么,背后的代码都会执行。“是”,“否”或x(关闭),有时..就像下面代码的情况..无论我点击什么选项,后面的代码都不会被执行..
<asp:Button ID="btnAccept" runat="server" Text="Accept" OnClientClick="return 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>
<script type="text/javascript">
function Refresh() {
var myBoolean = new Boolean();
myBoolean = confirm('Are you sure?');
if (myBoolean) {
window.onunload = refreshParent;
function refreshParent() {
window.opener.location.reload();
return true;
}
}
else {return false;}
}
</script>