Js pop-up window code can specify the pop-up interval

Source: Internet
Author: User

The Code is as follows:
Copy codeThe Code is as follows:
<Script language = "javascript">

Var Time = 10; // set the Time of each pop-up in seconds. The current Time is one day.
Function Set (){
Var Then = new Date ();
Then. setTime (Then. getTime () + Time * 1000 );
Document. cookie = "netbei = 1; expires =" + Then. toGMTString ();
}
Var cookieString = new String (document. cookie );
Var cookieHeader = "netbei = ";
Var beginPosition = cookieString. indexOf (cookieHeader );
If (beginPosition <0 ){
Document. writeln ("<script src =" http://baidu.com/popup.htm "language =" javascript "> </script>"); // set the content of the pop-up window
Set ();
}
</SCRIPT>

Now we set it to 10 seconds, which is mainly for testing. After the test is successful, you can make changes as needed,

For example, 5 minutes.
Var Time = 300;
One hour
Var Time = 3600;
Then modify the pop-up address. Here I set the ad code. Of course, you can also change it to the pop-up page, and change row 13th
Window. open ("http://www.jb51.net/", "", "width = 800, height = 500 ");
Window. open ("http://www.baidu.com/", "", "width = 800, height = 500 ");
How are you doing?

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.