title: How to register document.onkeypress event
body: <p>I want to register keypress events for a document using javascript.</p>
  
  <p>I have used:</p>
  
  <pre><code>document.attachEvent("onkeydown", my_onkeydown_handler);
  </code></pre>
  
  <p>It works fine with IE, 
  but not with Firefox and Chrome.</p>
  
  <p>I also tried:</p>
  
  <pre><code>document.addEventListener("onkeydown", my_onkeydown_handler, true); 
  // (with false value also)
  </code></pre>
  
  <p>But it still doesn't work with Firefox and Chrome.</p>
  
  <p>Is there a solution, am I missing something?</p>