JavaScript Keyboard event listeners use JavaScript for Web keyboard event listening capture, mainly using onkeypress, onkeydown, onkeyup three of events. The order of execution of the three events is as follows: OnKeyDown, onkeypress->onkeyup. In general, three keyboard events are used to respond effectively to keyboard input. The actual use of the difference is as follows: onkeypress Event can not be the system function keys (for example: back, delete, etc., where the Chinese input method does not respond effectively) to the normal response, onkeydown and onkeyup can be effective interception of system function keys, But the location of the event interception is different, you can choose different keyboard events depending on the situation. Because onkeypress cannot capture system function keys, the KeyCode property of the Window.event object is different from the KeyCode attribute obtained in Onkeydown,onkeyup keyboard events. The main performance at two points: onkeypress Event keycode Sensitive to the case of letters, and onkeydown, onkeyup events are not sensitive; onkeypress Event KeyCode can not distinguish between the number keys on the main keyboard and the number of keys to pay the keyboard, And onkeydown, onkeyup of the keycode on the main keyboard to pay the number keys sensitive; Implementation code excerpt from: http://www.cnblogs.com/xiaoao808/archive/2008/07/31/1257624.html
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >< HTML xmlns= "http://www.w3.org/1999/xhtml" > JS Monitor Keyboard Case Events