Keycode and charcode

Source: Internet
Author: User
Firefox return key
Keycode (keypress) function key (shift, Ctrl, ALT, printscreen, scrolllock no return value) returns the correct value, all other key values are 0
Keycode (keydown) returns all the key values except printscreen. The primary key displays the key value (65-90) in the uppercase/lowercase state)
Keycode (keyup) returns all key values except printscreen. The primary key displays the key value in the uppercase/lowercase state (65-90)

Charcode (keypress) returns the character key (65-90, 97-122), shift, Ctrl, ALT, printscreen, scrolllock, and no return value. All other key values are 0.
Charcode (keydown) all key values are 0
Charcode (keyup) all key values are 0

Keycode (keypress) returns the correct values of all character keys (case-sensitive 65-90, 97-122)
Keycode (keydown) returns all the key values except printscreen. The primary key displays the key value (65-90) in the uppercase/lowercase state)
Keycode (keyup) returns all key values except printscreen. The primary key displays the key value in the uppercase/lowercase state (65-90)

Charcodeie does not support this attribute

Test keycode, charcode value, ff, and IE always get unexpected results. It was completely irregular, and later we found that different events would lead to different results. As shown in the preceding table, keycode and charcode returned by different browsers and Keyboard Events (charcode is not supported by IE) are not tested. Safari and opera are not tested ~ ····

Original article address:

Omiga.org/blog/archives/50

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.