1
我已經爲打開的彈出框編寫了這段代碼。代碼如下所述。我已經設置了cookie,以便它只打開一次。我有問題,而我點擊關閉按鈕cookie沒有設置爲彈出,以便它重新打開每一次。當點擊彈出框的關閉按鈕時cookie沒有被設置
<div id="abcPopup">
<div id="popup-title">
Hello
</div>
<div id="description">
</div>
<div id="picture">
</div>
<span style="display: none;" id="notification"></span>
</div>
我的jQuery代碼如下所示
$(document).ready(function() {
var pageVisitedcookiesValue = getCookie("page_visited");
if (pageVisitedcookiesValue == null || pageVisitedcookiesValue != "true") {
var pageVisited;
setTimeout(function() {
$("#abcPopup").dialog({
show: { effect: 'fade', duration: 450 },
hide: { effect: 'fade', duration: 450 }
});
}, 3000);
$('.ui-button-icon-only').click(function() {
pageVisited = true;
document.cookie = "page_visited" + "=" + pageVisited + ";" + "path=/";
});
}
});
function getCookie(c_name) {
var c_value = document.cookie;
var c_start = c_value.indexOf(" " + c_name + "=");
if (c_start == -1) {
c_start = c_value.indexOf(c_name + "=");
}
if (c_start == -1) {
c_value = null;
}
else {
c_start = c_value.indexOf("=", c_start) + 1;
var c_end = c_value.indexOf(";", c_start);
if (c_end == -1) {
c_end = c_value.length;
}
c_value = unescape(c_value.substring(c_start, c_end));
}
return c_value;
}
現在我ahve而我設置超時時間爲打開的對話框中我的onclick事件是不是同時關閉按鈕點擊關閉彈出框捕捉只會出現問題。
我已經把警報框的相同,但其按鈕點擊甚至沒有火災或得到如此警覺發生,但雖然我會刪除設置超時功能我的彈出窗口工作正常。即使是關閉按鈕上的警報也是如此。
請爲相同的指導。