廢話(huà)不多說(shuō)了,直接給大家貼代碼了,具體代碼如下所示:
function cookieGO(name) { var today = new Date(); var expires = new Date(); expires.setTime(today.getTime() + 1000*60*60*24); setCookie("cookievalue", name, expires); } function setCookie(name, value, expire) { window.document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString())); } function getCookie(Name) { var findcookie = Name + "="; if (window.document.cookie.length > 0) { // if there are any cookies offset = window.document.cookie.indexOf(findcookie); if (offset != -1) { // cookie exists 存在 offset += findcookie.length; // set index of beginning of value end = window.document.cookie.indexOf(";", offset) // set index of end of cookie value if (end == -1) end = window.document.cookie.length; return unescape(window.document.cookie.substring(offset, end)); } } return null; } //提示過(guò)期彈框 if({$remindflag} == "1"){ setInterval(function TanChuang() { var c = getCookie("cookievalue"); if (c != null) { return; } cookieGO("getcookie"); G.alert({ "title":"過(guò)期提示", "pclass":"box", "text":"您的錯(cuò)題本服務(wù)將于"+"{$userinfo.member_end}"+"過(guò)期<br>為了不影響您的正常使用請(qǐng)續(xù)費(fèi)", "btnText":"購(gòu)買(mǎi)續(xù)費(fèi)", "alert":function(){ this._remove(); window.location.href = "/manage/pay/readyopenvip.php"; } }); },2000); } 以上所述是小編給大家介紹的利用cookies設(shè)置每隔24小時(shí)彈出框,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)VeVb武林網(wǎng)網(wǎng)站的支持!
新聞熱點(diǎn)
疑難解答