title: How to give focus() after an alert()?
body: <p>I have something like:</p>
  
  <pre><code>&lt;input type="textbox" id="partNumber" onChange="validatePart(this);"&gt;
  &lt;input type="textbox" id="quantity" onfocus="saveOldQuantity(this);"&gt;
  </code></pre>
  
  <p>The <code>onChange</code> event is properly firing after a change is made <em>and</em> the textbox loses focus. When <code>quantity</code> gains focus, the <code>onfocus</code> event is properly firing to save the old value of <code>quantity</code> before changes are made.</p>
  
  <p>If <code>validatePart()</code> detects an invalid <code>partNumber</code> value, it <code>alert</code>s the user to that fact. After the <code>alert()</code> has cleared, I'd like to return focus to the <code>partNumber</code> input. But doing a <code>focus()</code> on the input node is not giving it focus. Debugging is tricky here, because the IE debug window interaction is, of course, changing the focus.</p>
  
  <p>How can I ensure focus returns to <code>partNumber</code> if an error is detected in <code>validatePart()</code>?</p>
  
  <p>EDIT:
  A simple version of <code>validatePart()</code>:</p>
  
  <pre><code>function validatePart(node) {
      if (!node.value) {
          alert('Please enter a part number.');
          node.focus();   // &lt;======= why isn't this having any effect??
      }
  }
  </code></pre>