Hello Friends,
Scheduling a Function for Future Execution
Syntax: Scheduling is done with the window.setTimeout method:
window.setTimeout(“function to execute”,schedule time);
Sample:
<script type="text/javascript"> function hello() { window.alert(“Hello”); } window.setTimeout(“hello()”,5000);
</script>
----------------------------------------------------------
Scheduling a Function for Recurring Execution
Syntax:
function functionName() { some JavaScript code window.setTimeout(“functionName()”,schedule time); } window.setTimeout(“functionName()”,schedule time);
Sample:
<script type="text/javascript"> function hello() { window.alert(“Hello”); window.setTimeout(“hello()”,5000); } window.setTimeout(“hello()”,5000); </script>
----------------------------------------------------------
Canceling a Scheduled Function
Syntax:
var pointer = window.setTimeout(...); window.clearTimeout(pointer);
Sample:
<script type="text/javascript"> function hello() { window.alert(“Hello”); } var myTimeout = window.setTimeout(“hello()”,5000); window.clearTimeout(myTimeout); </script>
Thanks & Regards, Datta.G
|
No responses found. Be the first to respond and make money from revenue sharing program.
|