There is a better way to detect which key was pressed in JavaScript / jQuery.
First, on a general note, the keydown event is more effective at getting all the keys you want, as keypress won't necessarily fire on ENTER, ESC, TAB, arrow keys, etc.
To detect numbers from either the numeric keypad OR the line of numbers above the QWERTY keyboard, use:
event.keyIdentifier
or, with jQuery wrapped events:
event.originalEvent.keyIdentifier
"event" in these examples is the keydown event object.
This will give you a unicode string value representing the actual character of the key:
U+002F or U+0035, for example. Then, parse this unicode value as a hexidecimal number:
parseInt(event.keyIdentifier.substring(2),16)
Using 16 as the radix for parseInt will convert the hexidecimal number to a base-10.
With this method, all number keys will have the same value, whether they originate from the numberpad or the QWERTY keyboard. Numbers 0 - 9 are 48 - 57. So, an if() statement like this will find all numbers:
if (parseInt(event.keyIdentifier.substring(2),16) > 47 && parseInt(event.keyIdentifier.substring(2),16) < 58) {
doSomething();
}