The setTimeout and setinterval syntaxes are the same. They all have two parameters: one is the code string to be executed, and the other is the interval in milliseconds. after that period, the code will be executed.
However, there are differences between the two functions. After the setinterval code is executed, it automatically repeats the code after the fixed interval, setTimeout only executes the code once.
Difference: window. setTimeout ("function", time); // you can specify a time-out object, which is executed only once without a period.
Window. setinterval ("function", time); // you can specify a timeout object. The period is set to 'interaction time'
Stop timing:
Window. cleartimeout (object) Clear the setTimeout object that has been set
Window. clearinterval (object) Clear the setinterval object that has been set
========================================================== ========================
Showtime ();
Function Showtime (){
VaR today = new date ();
Alert ("the time is:" + today. tostring ());
SetTimeout ("Showtime ()", 5000 );
}
Once this function is called, the time is displayed every five seconds.
========================================================== ==================================
========================================================== ==================================
Setinterval ("Showtime ()", 5000 );
Function Showtime (){
VaR today = new date ();
Alert ("the time is:" + today. tostring ());
}
While setinterval is not bound by the function called by itself, it simply repeats the function at a certain time.
========================================================== ==============================================
If you want to execute an action accurately after a fixed interval, you 'd better use setinterval. If you don't want to interfere with each other due to continuous calls, in particular, each function call requires heavy computing and a long processing time, so it is best to use setTimeout.
Setinterval continues to execute the Specified Code until clearinterval is called to clear the timer object
SetTimeout: run the specified code once and clear the timer object using cleartimeout.
Both setinterval and setTimeout return the timer object identifier for clearinterval and cleartimeout calls.
Method to access the sub-page: Document. getelementbyid ("ifr_tab" pai.content?#doc ument. Location. Reload ();
How to access the parent page:
Window. opener. Location. Reload ();
Extends extends opener.doc ument. getelementbyid ("inputtextvalue"). innerhtml
Window. parant ....