Javascript implements special effects code for delayed display in the prompt box and javascript special effects code

Source: Internet
Author: User

Javascript implements special effects code for delayed display in the prompt box and javascript special effects code

This example describes how to use setTimeout in JavaScript to implement a latency pop-up warning box. Share it with you for your reference. The details are as follows:

First, we will show you a JS Code for the latency/Timing/forced pop-up window.

Parameter description: Set Time: Then. setTime (Then. getTime () + 1*60*60*1000) http: // pop-up page in mylove/ttan.htm(transition webpage: ttan.htm/is the page to pop up scroll: 1 (scroll bar) status: 1 (status bar) help: 1 (help button) toolbar = 1 (toolbar) resizable: 1 (Can you drag the mouse to change the size) dialogWidth: 800px (width) dialogHeight: 600px (height) 3000 (delayed pop-up time, in milliseconds. 1 second = 1000 milliseconds) <! -- Pop-up advertisement --> <script language = "JavaScript"> function Get () {var Then = new Date () Then. setTime (Then. getTime () + 1*60x60*1000) var cookieString = new String (document. cookie) var cookieHeader = "Cookie1 =" var beginPosition = cookieString. indexOf (cookieHeader) if (beginPosition! =-1) {} else {document. cookie = "Cookie1 = POPWIN; expires =" + Then. toGMTString () focusid = setTimeout ("comment ','', 'scroll: 0; status: 0; help: 0; resizable: 0; dialogWidth: 0px; dialogHeight: 0px ') ", 3000) window. focus () ;}} Get (); </script> <! -- Pop-up and end --> ttan.htm content: <script language = "javascript"> <! -- Window. open ("http: // pop-up webpage/"); // --> </script> <script LANGUAGE = "JavaScript"> <! -- SetTimeout ('window. close (); ', 0) // --> </script> can be used to bring up a single IP address only once in a certain period of time. It can be delayed and forced to bring up !!

After the following code is executed, a warning box will pop up with a delay when you click the button, which mainly demonstrates how to use setTimeout.

<! DOCTYPE html> 

Note the notes that need to be noted when writing the delayed prompt box. Note the notes one by one. After reading the video tutorial, this function is smooth, the reason is that a list of required functions is implemented one by one according to the list before writing the code. If there is a problem, it is much better to adjust the corresponding functions than to write the code directly.

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.