title: onkeydown not working properly for form inputs
body: <p>I have an html page with a form text input that has a onkeydown attribute, like so:</p>
  
  <pre><code>&lt;DOCTYPE !html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
  &lt;title&gt;Lookup User&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form method="POST"&gt;
  &lt;strong&gt;Last Name: &lt;/strong&gt;&lt;input type="text" id="lname" onkeydown="lookup_user(this.value)" /&gt;
  
  &lt;/form&gt;
  &lt;span id="test"&gt;&lt;/span&gt;
  &lt;script type="text/javascript" src="lookup_user.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The page makes asynchronous requests to a server to searchup the user as the keys are being downed. The javascript file is</p>
  
  <pre><code>function lookup_user (lname) {
  
  var xmlhttp;
  
  if (lname=='') {
      document.getElementById('lname').innerHTML = '';
      return;
  }
  
  if (window.XMLHttpRequest) {
      xmlhttp = new XMLHttpRequest();
  }
  else {
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  
  
  
  // generally preferred to place onreadystatechange before open so that it detects readyState 0-4 instead of 1-4
  xmlhttp.onreadystatechange = function () {
      if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200) {
          document.getElementById("test").innerHTML = xmlhttp.responseText;
  
      }
  }
  
  xmlhttp.open('POST', 'lookup_user.php', true);
  xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  xmlhttp.send('lname='+lname);
  
  
  
  }
  </code></pre>
  
  <p>This works almost fine, except for the fact that it doesn't detect the first keydown. </p>
  
  <p>For example, if in the input form, I type in 'D', it doesn't search up the user. When I type in the second character, it searches up the characters before the second character, not including the second character. If I want to look up "Daisy", and type in "Daisy" into the input box, it searches up "Dais". Only when I down another key does it lookup "Daisy".</p>
  
  <p>Why is this?</p>