|
-
Jan 10th, 2002, 12:40 AM
#1
Thread Starter
Fanatic Member
Time out for JavaScript
>>> JS experts, anyone know how to set timeout in JavaScript?

prog_tom
JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
http://physics.sviesoft.com/forum
-
Jan 10th, 2002, 03:44 AM
#2
Hyperactive Member
simple really:
setTimeout("myFunction()", 1000);
1000 is equal to one second.
example of how setTimeout should be used:
Code:
<html>
<script language="javascript">
var a = 0;
// used as a reference to the timeout so that we
//can stop the loop with clearTimeout
var timeout_handle;
incrementCounter(a);
function incrementCounter(x){
current_loop = x + 1;
alert("loop number" + current_loop);
timeout_handle = setTimeout("incrementCounter(current_loop)", 3000);
}
</script>
<body>
<a href="#" onclick="clearTimeout(timeout_handle)">click here to stop the timeout</a>
</body>
</html>
hope this helps you understand it more
-
Jan 10th, 2002, 05:44 PM
#3
Thread Starter
Fanatic Member
Thanks Buddy

prog_tom
JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
http://physics.sviesoft.com/forum
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|