JS uses cookies to set jscookies every 24 hours

Source: Internet
Author: User
Tags setcookie

JS uses cookies to set jscookies every 24 hours

If you don't talk much about it, paste the Code directly. The specific code is as follows:

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) {too many Doc ument. cookie = name + "=" + escape (value) + (expire = null )? "": ("; Expires =" + expire. toGMTString ();} function getCookie (Name) {var findcookie = Name + "="; if (window.w.doc ument. cookie. length> 0) {// if there are any cookies offset = too many Doc ument. cookie. indexOf (findcookie); if (offset! =-1) {// cookie exists offset + = findcookie. length; // set index of beginning of value end = specified parameter Doc ument. cookie. indexOf (";", offset) // set index of end of cookie value if (end =-1) end = your own Doc ument. cookie. length; return unescape(window.doc ument. cookie. substring (offset, end) ;}} return null ;}// if ({$ remindflag} = "1") {setInterval (function TanChuang () {var c = getCookie ("Cookievalue"); if (c! = Null) {return;} cookieGO ("getcookie"); G. alert ({"title": "Expiration Prompt", "pclass": "box", "text": "Your error message will be posted on" + "{$ userinfo. member_end} "+" expired <br> Please renew for "," btnText ":" buy expired "," alert ": function () {this. _ remove (); window. location. href = "/manage/pay/readyopenvip. php ";}}) ;}, 2000 );}

The above is a pop-up box for setting cookies every 24 hours. I hope it will help you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.