SetTimeout() command

To call a javaScript function at a time in milliseconds in the future use this:
	var mytimer= setTimeout("thfn()",2000);

Where the parameters are the function to be called (in brackets) and the delay before its called, in milliseconds and the return value is an identifier that cancels the evaluation with the clearTimeout() method.

	clearTimeout(mytimer);

Control returns to the rendering engine during the delay, so this is a good way to see the effect of dynamic changes to the page which otherwise would not happen until after the whole JavaScript code had finished.

This page called an init() function onload which looks like this:

function init(){
	var hellotimeout= setTimeout("alert('Hello, this is an example')", 3000);
	var mytimer= setTimeout("changecols(0)",2000);
}
which is why the colours changed as you read this.

Much more on this at http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/settimeout.asp.

Stephen Woodruff