title: Which browsers use which key event system?
body: <p>I notice that Javascript code seems to be written to read keystrokes in completely different ways, which I guess is to support different browsers. For example, here is one code block from a web page:</p>
  
  <pre><code>if (document.addEventListener)
  {
     document.addEventListener("keydown",keydown,false);
     document.addEventListener("keypress",keypress,false);
     document.addEventListener("keyup",keyup,false);
     document.addEventListener("textInput",textinput,false);
  }
  else if (document.attachEvent)
  {
     document.attachEvent("onkeydown", keydown);
     document.attachEvent("onkeypress", keypress);
     document.attachEvent("onkeyup", keyup);
     document.attachEvent("ontextInput", textinput);
  }
  else
  {
     document.onkeydown= keydown;
     document.onkeypress= keypress;
     document.onkeyup= keyup;
     document.ontextinput= textinput;   // probably doesn't work
  }
  </code></pre>
  
  <p>Judging from this code it would appear different browsers have completely different keystroke handling mechanisms. Which of the above mechanisms corresponds to which browser(s)?</p>