wac
06-16-2003, 07:21 PM
I want to write a javascript function to disallow an entry field from accepting non-numeric entries (except of course, backspace, delete, and some other keys). I've seen some examples of using the event.keycode (or event.which) object to do this. My concern keyboards in different locales. I'm sure there are lots of you out there with different locale keyboards. Do the numeric key codes (key pad and regular numeric) have the same value on all keyboards?? What about keys like + -, up/down arrow, page up/page down, home, end, delete, backspace, insert???
I don't have access to keyboards from other locales so I must ask here. Is there some document which lists what the keycodes are in all locales (if they are not the same???).
Also, should I be using the keyup, keydown, or keypress event to filter out keys?
One last thing. Before I struggle to write one, does anyone have a generic javascript function which can be passed a regular expression and can determine on each keypress whether the current value matches, and reject non-matches??
I don't have access to keyboards from other locales so I must ask here. Is there some document which lists what the keycodes are in all locales (if they are not the same???).
Also, should I be using the keyup, keydown, or keypress event to filter out keys?
One last thing. Before I struggle to write one, does anyone have a generic javascript function which can be passed a regular expression and can determine on each keypress whether the current value matches, and reject non-matches??