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
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.