2012-06-26 81 views
0

我有一個要求,在我們的一個處理頁面上顯示退出彈出窗口。我顯示退出彈出註冊一個客戶端的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

如果我實現然後我就加document.getElementById(id).style.display ='none'; –

回答

0
if (document.getElementById('<%=Panel.ClientID %>').style.display == "") { 
$find("<%= Popup.ClientID %>").hide(); 
document.getElementById("<%= btncloseAcc.ClientID %>").click(); 
} 

試試這個..........