This method is used to call a function or evaluate an expression at specified intervals, in milliseconds.
This will continue until the clearInterval method is called or the window is closed. The ID value returned by setInterval is used as the parameter for the clearInterval method. Note that if an expression is to be evaluated, it must be quoted to prevent it being evaluated immediately.
<form name="myForm" action="" method="POST">
<input name="myClock" type="Text">
<script language=javascript>
self.setInterval('clock()', 50)
function clock() {
time=new Date()
document.myForm.myClock.value=time
}
</script>
</form>
This example uses the setInterval method to call the clock() function which updates the time in a text box.