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:
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
}
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)?