我需要在其中一个处理页面上显示“退出弹出窗口”。我通过注册客户端javascript(如
)来显示退出弹出窗口window.onbeforeunload = ShowExitPopUp();
如果关闭窗口,或者尝试键入其他URL,弹出窗口就会正常运行。但问题是,一旦进程完成,我的处理页面也在服务器端执行“Response.Redirect”。当response.redirect发生时,exitpopup也会出现。有没有办法在这种情况下不显示退出弹出窗口?
这是我正在使用的代码
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.Event.subscribe('comment.create',
function (response) {
window.location = "http://domain.com";
});
FB.Event.subscribe('comments.remove',
function (response) {
window.location = "http://domain.com";
});
};
(function() {
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
//]]>
</script>
<script type="text/javascript">
var ShowExitPopup = true;
function ExitPage()
{
if (ShowExitPopup)
{
ShowExitPopup = false;
location.href = "http://www.YOURURL.com/destination";
return '****************************************\n\YOUR HEADLINE\n\n YOUR TEXT1 \n\n YOUR TEXT "\n\n | |\n | |\n V V\n 96+ v\n ********************************************************\n';
}
}
</script>
答案 0 :(得分:0)
if (document.getElementById('<%=Panel.ClientID %>').style.display == "") {
$find("<%= Popup.ClientID %>").hide();
document.getElementById("<%= btncloseAcc.ClientID %>").click();
}
试试这个..........