asp.net.ph

Skip Navigation Links

setInterval Method

DHTML Methods


Evaluates an expression each time a specified number of milliseconds has elapsed.

Syntax

iTimerID = window.setInterval ( vCode, iMilliSeconds
    [ ,  sLanguage ] ) 
Parameters

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.

Return Value

Integer. Returns an identifier that is used to cancel the interval with the clearInterval method.

Example

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 

Applies To

window



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note