小编Est*_*her的帖子

对于在午夜到期的cookie的代码Javascript

我有一个带有cookie的弹出窗口,它会在一天(24小时)内到期,我希望这个cookie每天午夜到期(所以弹出窗口显示你每天第一次进入网络).我不是程序员,所以,请问有人可以告诉我在代码中需要更改的内容吗?我已经阅读了一些问题的解决方案,但我不知道如何实现它.

//CONTROLLING EVENTS IN jQuery
$(document).ready(function(){
if ($.cookie("anewsletter") != 1) { 
//centering with css
centerPopup();
//load popup
loadPopup(); 
}     
//CLOSING POPUP
//Click the x event!
$("#popupContactClose").click(function(){
disablePopup();
$.cookie("anewsletter", "1", { expires: 1 });
});

//Click the bacground!
$("#backgroundPopup").click(function(){
disablePopup();
$.cookie("anewsletter", "1", { expires: 1 });
});


//Press Escape event!
$(document).keypress(function(e){
if(e.keyCode==27 && popupStatus==1){
    disablePopup();
    $.cookie("anewsletter", "1", { expires: 1 });
}
});

});
Run Code Online (Sandbox Code Playgroud)

非常感谢你!

javascript cookies jquery

3
推荐指数
1
解决办法
2915
查看次数

标签 统计

cookies ×1

javascript ×1

jquery ×1