title: JavaScript: Error "Object doesn't support this action"
body: <p><a href="http://jsfiddle.net/w2JqT/" rel="nofollow">The code</a> for a counter gives an error</p>
  
  <p>Whereas <a href="http://jsfiddle.net/W9L39/" rel="nofollow">a similar snippet</a> does not</p>
  
  <p>I can't figure out any valid reason...</p>
  
  <p>The line under consideration is:  </p>
  
  <pre><code>&lt;input type=button name="but2" value="stop" onClick="window.clearTimeout(ID);"&gt;    
  </code></pre>
  
  <p>The complete code is:</p>
  
  <pre><code>&lt;html&gt;
          &lt;head&gt;
          &lt;script language="JavaScript"&gt;
              var counter=0;
              ID=window.setTimeout("start();",2000);
              function start()
              {
                  counter++;
                  document.forms[0].elements[0].value=counter;
                  ID=window.setTimeout("start();",2000);
              }
          &lt;/script&gt;
          &lt;/head&gt;
          &lt;body&gt;
              &lt;form name="frm1"&gt;
                  &lt;input type="text" name="timer1"&gt;
                  &lt;input type="button" name="but1" value="start" onClick="counter=0; start();"&gt;
                  &lt;input type=button name="but2" value="stop" onClick="window.clearTimeout(ID);"&gt;
              &lt;/form&gt;
          &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>