Hi there!
I will be most grateful if someone can answer my two questions. The questions are after the code.
<html> <head> <title>clearInterval() Test</title>
<script> var tev; function startInt() { tev = setInterval(hello, 1000); } function hello() { document.f.secs.value = String(Number(document.f.secs.value)+1); } function stopping() { clearInterval(tev); } </script>
</head> <body>
<button onclick="startInt();">Start</button>
<form name="f"> <input type="text" name="secs" value="0"/> <button onclick="stopping();">Stop</button> </form>
</body> </html>
So, my first question is: why does the start button not work when it is set within the form ie:
<form name="f"> <input type="text" name="secs" value="0"/> <button onclick="startInt();">Start</button> <button onclick="stopping();">Stop</button> </form>
My second questions is: why will the stop button (after clicked) reset the form field to zero if it is within the form and not reset to zero if it is set outside of the form?
web site development services | Web development company