JavaScript setTimeout

by top54u.com 19 Mar, 2008
Spotlight.....

Javascript setTimeout function evaluates the expression after the time specified in milliseconds. setTimeout function of Javascript delays the execution of the function or expression specified with the time specified.

 

Javascript setTimeout syntax:

 

setTimeout (expression, msec, lang);

 

setTimeout function takes 3 parameters:

Expression: Name of the function to call or the javascript expression to evaluate.

Msec:  Time in milliseconds after which the specified expression is evaluated.

Lang: Optional parameter to specify the scripting language e.g.: Jscript, Javascript, vbscript.

 

 

Javascript setTimeout Example:

 

<input type="button" value="get message" onclick="getMessage();"/>

 

<script language="javascript">


function getMessage()

{

var timeOut = setTimeout ( "alert( 'Delay of 5 seconds!!!' )" , 5000);

}

</script>

 

In the above example setTimeout function will display the alert message box after 5000 milliseconds i.e. 5 seconds.

Spotlight.....

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , , , , ,

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

8/23/2008 9:09:15 PM

OUR SPONSORS[+ advertise here]
related videos.....
recent posts.....
top54u ezines.....