我有一个jquery对话框,当我打开并关闭它时,转到另一个页面,然后返回浏览器返回按钮,再次显示该对话框。这种情况发生在Chrome和IE浏览器中,而不是Firefox中。我可以修改什么对话框?谢谢!
<td class ="approval-img"><asp:ImageButton runat="server" CommandArgument = '<%# Eval("aux_approvalId")%>' OnClick="getApprovalID_approve" ToolTip="Approve" ImageUrl="/Images/Approve.png" /></td>
protected void getApprovalID_approve(object sender, EventArgs e)
{ .....
string script = "OpenApprovalDialog();";
Page.ClientScript.RegisterStartupScript(typeof(Page), "", script, true);
}
这些是打开/关闭对话框的功能:
function OpenApprovalDialog() {
$.blockUI({ message: $('#approval-form'), baseZ: 10000 });
$('#approval-form').parent().appendTo($("form:first"));
return false;
};
$('#btnCancelApprove').click(function () {
$.unblockUI();
$("#approval-form").parent().detach();
return false;
});
打开的对话框:
<div id="approval-form" style="display: none; cursor: default" title="Approve">
<div class="approve-change">
<ul>
<li>
<p><label>Approve change: </label><label>Reason</label></p>
<textarea id="txtReasonApprove" runat="server" cols="1" rows="1" class="required"></textarea><br />
</li>
<li>
<span>
<button id="btnCancelApprove" class="blue-problem">Cancel</button>
<asp:Button ID="btnApprove" runat="server" CssClass="blue-problem" Text="Approve" ToolTip = "Approve" OnClick="ApproveChange_Click"/>
</span>
</li>
</ul>
答案 0 :(得分:0)
在离开页面之前设置此脚本。
<script>
window.onbeforeunload = function (e) {
$.unblockUI();
};
</script>