JavaScript key handling and browser compatibility

The following article by Jan Wolter has never failed me and is far and away the best resource on browser key events I've seen: http://unixpapa.com/js/key.html. It answers all the questions you posed.

One thing to emphasize is that with careful use of the key event properties at your disposal you will almost certainly never need to sniff for a particular browser in your key handling code.


See the following pages, they will answer your quetions:

onkeydown event, onkeypress event, keyCode property, charCode property, which property