Repeatedly call a JScript function with setInterval()
 
Both Internet Explorer and Netscape Navigator offer a new JavaScript function with 
which you can repeatedly call a function at a set interval -- the setInterval() function. This function 
is only available in 4.0+ browsers, and conforms to the following syntax:
 
setInterval("myFunctionName", milliSecs)
 
As you can see, the first argument is the name of the function you wish to repeat, 
and the second argument contains the delay, in milliseconds, between each call. So, for example, 
to run the function myFunction() every five seconds, you'd use
 
setInterval("myFunction()", 5000)
 
This function returns an id number that you use in conjunction with clearInterval() 
to stop execution, as in
 
var myID = setInterval("myFunction()", 5000)
clearInterval(myID)
 
 


Active Server Index

Main Index

Search RD Techbase