Stop a time out timer in JavaScript
Description
The following code shows how to stop a time out timer.
Example
<!--from ww w . ja v a2s . c o m-->
<!DOCTYPE HTML>
<html>
<body>
<script type="text/javascript">
var timeoutId = setTimeout(function() {
document.writeln("Hello world!");
}, 1000);
clearTimeout(timeoutId);
</script>
</body>
</html>
The code above generates the following result.
Javascript Tutorial Timer Event
Clear the timer in JavaScript
Create a time out timer in JavaScript
Create text move animation with timer in Ja...
Fire Timer event in JavaScript
Set the timeout for the timer according to ...
Start a timer and cancel a timer in JavaScr...
Use window.clearInterval() to stop a timer ...
Use window.clearTimeout() to stop timer in ...
Clear the timer in JavaScript
Create a time out timer in JavaScript
Create text move animation with timer in Ja...
Fire Timer event in JavaScript
Set the timeout for the timer according to ...
Start a timer and cancel a timer in JavaScr...
Stop a time out timer in JavaScript
Use timer in JavaScriptUse window.clearInterval() to stop a timer ...
Use window.clearTimeout() to stop timer in ...