Wednesday, January 19, 2011

The setTimeout() method calls a function or evaluates an expression after a specified number of milliseconds.

use  javascript settimeout() method just to execute a method after some interval of time
the syntax to use this is :

setTimeout(code,millisec)

Example :
<html>
<head>
<script type="text/javascript">
function timedMsg()
{
var t=setTimeout("alert('I am displayed after 3 seconds!')",3000)
}
</script>
</head>
<body>

<form>
<input type="button" value="Display timed alertbox!" onclick="timedMsg()" />
</form>

</body>
</html>

No comments:

Post a Comment