<html>
<head>
<title>Using window.clearInterval()</title>
<script language="JavaScript1.2">
<!--
var counter = 1;
function startCounter(){
document.myForm.myText.value = counter++;
}
function stopCounter(){
window.clearInterval(myInterval);
}
var myInterval = window.setInterval("startCounter()", 1000)
-->
</script>
</head>
<body onLoad="startCounter()">
<form name="myForm">
<input type=TEXT size=20 value="" name="myText">
<input type=BUTTON value="Clear Interval" onClick="stopCounter()">
</form>
</body>
</html>
|