DHTML Methods
Evaluates an expression each time a specified number of milliseconds has elapsed.
iTimerID = window.setInterval ( vCode, iMilliSeconds
[ , sLanguage ] )
vCode |
Required. Function pointer specifying the code to be executed at the specified interval. |
iMilliSeconds |
Required. Integer specifying the number of milliseconds. |
sLanguage |
Optional. String specifying any one of the possible values for the language attribute. |
Integer. Returns an identifier that is used to cancel the interval with the clearInterval method.
The following example shows use of setInterval to simulate a clock. Each time the interval elapses, the clock changes its readout.
setInterval ( tick, 1000 );
...
function tick ( ) {
var s = Date ( );
var t = s.substring ( 11, 19 );
...
theTime.innerText = t;
}
Show me
window