$.cookie("rmbUser", "true", {expires: 7}); //存储一个带7天期限的cookie function dq(){ var danqian=new Date()/1000; if((new Date("2019-10-1"))/1000danqian){ }else if((new Date("2019-10-1"))/1000>danqian){ alert("活动时间是10月1日到7日的"); //window.location.href="../index.html" }else{ //window.location.href="../index.html" alert("活动时间已经结束"); } }