title: Validate number javascript doesn't work in Chrome
body: <p>I used the script below in order to validate the numbers it works in IE but it doesn't work in the newer versions of Chrome. If the input is greater than 5 , alert window is diplayed but it cannot  be closed, I have to close all Chrome window. How to fix ?</p>
  
  <pre><code>&lt;HTML&gt;
  
  &lt;HEAD&gt;
  &lt;META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"&gt;
  
  
  
  &lt;script&gt;
  function validate(textarea) 
  {
      var wanted = "12345"
      var check ;
      var x ;
      for (var i=0; i&lt;textarea.value.length; i++) 
      {
          x = "" +textarea.value.substring(i, i+1);
          if (wanted.indexOf(x) == "-1") check = "stop";
      }
      if ( check== "stop")
      {
          alert("use only numbers from 1 to 5 ");
          textarea.focus();
          textarea.select();
      }
  
      if (textarea.value.length &gt; 1 )
      {
         alert("use only numbers from 1 to 5 ");
         textarea.focus();
         return (false);
      }
  }
      &lt;/script&gt;
   &lt;/HEAD&gt;
  &lt;BODY&gt;
  
   &lt;FORM name="game" &gt;
  
       &lt;table align="center"  border="0" width="225" bgcolor="#FFFFF0" &gt;
  
     &lt;TR&gt;&lt;TD colspan="9"&gt;Fill the cells with  digits 1-5, only one time each.      &lt;/TD&gt;&lt;/TR&gt;
   &lt;TR&gt;&lt;TD&gt;&lt;INPUT  name="a1" size="1"  value="" onBlur="validate(this)"&gt;&lt;TD&gt;    &lt;B&gt;&amp;nbsp;&lt;/B&gt;&lt;/TD&gt;
      &lt;TD&gt;&lt;INPUT  name="a2" size="1" onBlur="validate(this)"&gt;&lt;/TD&gt;
    &lt;TD&gt;&lt;B&gt;&amp;nbsp;&lt;/B&gt;&lt;/TD&gt;
     &lt;TD&gt;&lt;INPUT  name="a3" size="1"  value="" onBlur="validate(this)"&gt;
    &lt;/TD&gt;&lt;TD&gt;&lt;B&gt;&amp;nbsp;&lt;/B&gt;&lt;/TD&gt;
    &lt;TD&gt;&lt;INPUT  name="a4" size="1" onBlur="validate(this)"&gt;&lt;/TD&gt;
     &lt;TD&gt;&lt;B&gt;&amp;nbsp;    &lt;/B&gt;&lt;/TD&gt;
    &lt;TD&gt;&lt;INPUT  name="a5" size="1" onBlur="validate(this)"&gt;&lt;/TD&gt;
       &lt;/TR&gt;
  
    &lt;/FORM&gt;
  
   &lt;/TABLE&gt;
    &lt;/BODY&gt;
  </code></pre>