keydown, keypress and keyup return different things in different browsers. I'm not sure about Safari, but it is based on Gecko...
IE returns a property called keyCode for all three, but the actual character code (for 'Q' instead of 'q' when you press 'shift') is returned only on the keypress event.
firefox returns a keyCode for down and up, but you have to ask for
a charCode for a key press event.
However, firefox returns a character code (of '0') AND a keyCode on keypress when you press a function key.
Opera seems to use the IE model, keyCodes for all events, the character code returned on press.
In practice on keypress you can return the event.charCode (if there is one and it's not 0) or else return the event.keyCode;
For keyup and keydown you get consistent results from keyCode.