JavaScript implementation delay Display prompt box Special effects code _javascript tips

Source: Internet
Author: User

The example in this article describes the way JavaScript uses settimeout to implement a deferred pop-up warning box. Share to everyone for your reference. Specifically as follows:

First to show you a delay/timing/forced pop-up window of the JS code

Parameter interpretation: Set time: Then.settime (then.gettime () + 1*60*60*1000) mylove/ttan.htm (Transition page) ttan.htm http://pop-up page/is the page to be ejected scroll:1 ( scroll bar) status:1 (status bar) help:1 (Help button) toolbar=1 (Toolbar) resizable:1 (whether you can drag and resize with the mouse) dialogwidth:800px (width) dialogheight:600px ( Height) 3000 (delay ejection time in milliseconds.) 1 sec =1000 ms <!--pop-up ad--> <script language= "JavaScript" > function get () {var Then = new Date () Then.settime (Then . GetTime () + 1*60*60*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 ("Focus"); Window.showmodelessdialog (' ttan.htm ', ', ', ' scroll:0;status:0;help:0;
Resizable:0;d ialogwidth:0px;dialogheight:0px ') ", 3000) window.focus ();
}}get (); </script> <!--pop-up end--> ttan.htm content: <script language= "JavaScript" > <!--window.open ("http://pop-up page
/");
--> </script> <script language= "JavaScript" ><!--settimeout (' Window.close (); ', 0)//--> </script> can achieve the same IP within a certain period of time only pop-up, you can implement a delay pop-up, you can implement forced eject!! 

The following code after the execution of the click button will delay pop-up a warning box, mainly demonstrated the use of settimeout

<! DOCTYPE html>  

The points you need to be aware of when you write a deferred prompt box are recorded in the annotation. One by one, this feature looked at the video tutorial after the implementation of a smoother, because before the code to write a list of required functions to do, according to the list of the implementation of the corresponding adjustment of the problem to write the code more powerful.

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.