Share the sample code of JS setting every 24 hours with cookies

Source: Internet
Author: User
This article describes how to use cookies to set the instance code in the pop-up box every 24 hours. For more information about how to use cookies to set the sample code in the pop-up box every 24 hours, for more information, see

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
Please renew "," btnText ":" buy balance "," alert ": function () {this. _ remove (); window. location. href = "/manage/pay/readyopenvip. php ";}}) ;}, 2000 );}

If you need to learn about js, please follow the first PHP community js video tutorial. You can watch many js online video tutorials for free!

The above is to share the details of the Instance code that JS uses cookies to set every 24 hours in the pop-up box. For more information, see other related articles in the first PHP community!

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.