JS Monitor Keyboard Case Events

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.