The following are:
1. Countdown timer: timename=setTimeout("function();",delaytime);
2. Loop timer: timename=setInterval("function();",delaytime);
The first parameter "function()" is the action to be executed when the timer triggers. It can be a function or several functions, and the functions can be separated by ";". For example, if two warning windows are popped up, you can change "function();" to
"alert('first warning window!');alert('second warning window!');" and the second parameter "delaytime" is the interval time, in milliseconds, that is, fill in "5000", which means 5 seconds.
The countdown timer triggers an event after the specified time arrives, while the loop timer triggers an event repeatedly when the interval arrives. The difference between the two is that the former only acts once, while the latter acts constantly.
For example, after you open a page and want to automatically jump to another page within a few seconds, you need to use the countdown timer "setTimeout("function();",delaytime)", and if you want to set a sentence to appear one by one,
Then you need to use the loop timer "setInterval("function();",delaytime)".
Get the focus of the form, and then use it. Use if to determine whether the ID and form are the same.
For example: if ("mid" == ) {alert();}, "mid" is the ID corresponding to the form.
Timer:
Used to specify that a program is executed after a specific period of time.
Timed execution in JS, the difference between setTimeout and setInterval, and the l-release method
setTimeout(Expression,DelayTime), after DelayTime, Expression will be performed, setTimeout will be used for a delay of a period of time before performing a certain operation.
setTimeout("function",time) Sets a timeout object
setInterval(expression, delayTime), each DelayTime, will execute Expression. It can often be used to refresh expressions.
setInterval("function",time) Sets a timeout object
SetInterval is automatic repeating, setTimeout will not repeat.
clearTimeout(Object) Clear the setTimeout object that has been set
clearInterval(Object) Clear the setInterval object that has been set