I have the following javascript code...Here I am using onKeyPress=\"someFunction( )\" in the body tag to get the keyCode of the key that is pressed.
Browsers have different ways of handling keyboard events. Have a look at http://unixpapa.com/js/key.html for more info.
For example, these changes to your code will get it working in Firefox:
and
function keypress(e) { alert(window.event ? event.keyCode : e.which); // other stuff }