JavaScript keyboard event. keyCode Value List

Source: Internet
Author: User

The KeyCode value collected on the internet is convenient for you to find:

Keycode 8 = BackSpace
Keycode 9 = Tab
Keycode 12 = Clear
Keycode 13 = Enter
Keycode 16 = Shift_L
Keycode 17 = Control_L
Keycode 18 = Alt_L
Keycode 19 = Pause
Keycode 20 = Caps_Lock
Keycode 27 = Escape
Keycode 32 = space
Keycode 33 = Prior
Keycode 34 = Next
Keycode 35 = End
Keycode 36 = Home
Keycode 37 = Left
Keycode 38 = Up
Keycode 39 = Right
Keycode 40 = Down
Keycode 41 = Select
Keycode 42 = Print
Keycode 43 = Execute
Keycode 45 = Insert
Keycode 46 = Delete
Keycode 47 = Help
Keycode 48 = 0 equal braceright
Keycode 49 = 1 exclam onesuperior
Keycode 50 = 2 quotedbl twosuperior
Keycode 51 = 3 section threesuperior
Keycode 52 = 4 dollar
Keycode 53 = 5 percent
Keycode 54 = 6 ampersand
Keycode 55 = 7 slash braceleft
Keycode 56 = 8 parenleft bracketleft
Keycode 57 = 9 parenright bracketright
Keycode 65 = a
Keycode 66 = B B
Keycode 67 = c C
Keycode 68 = d D
Keycode 69 = e E EuroSign
Keycode 70 = f F
Keycode 71 = g G
Keycode 72 = h H
Keycode 73 = I I
Keycode 74 = j J
Keycode 75 = k K
Keycode 76 = l L
Keycode 77 = m M mu
Keycode 78 = n N
Keycode 79 = o O
Keycode 80 = p P
Keycode 81 = q Q
Keycode 82 = r R
Keycode 83 = s
Keycode 84 = t T
Keycode 85 = u U
Keycode 86 = v V
Keycode 87 = w
Keycode 88 = x X
Keycode 89 = y Y y
Keycode 90 = z Z
Keycode 96 = KP_0 KP_0
Keycode 97 = KP_1 KP_1
Keycode 98 = KP_2 KP_2
Keycode 99 = KP_3 KP_3
Keycode 100 = KP_4 KP_4
Keycode 101 = KP_5 KP_5
Keycode 102 = KP_6 KP_6
Keycode 103 = KP_7 KP_7
Keycode 104 = KP_8 KP_8
Keycode 105 = KP_9 KP_9
Keycode 106 = KP_Multiply
Keycode 107 = KP_Add
Key code 108 = KP_Separator
Keycode 109 = KP_Subtract
Key code 110 = KP_Decimal
Keycode 111 = KP_Divide
Key code 112 = F1
Keycode 113 = F2
Key code 114 = F3
Keycode 115 = F4
Key code 116 = F5
Keycode 117 = F6
Key code 118 = F7
Key code 119 = F8
Keycode 120 = F9
Keycode 121 = F10
Keycode 122 = F11
Key Code 123 = F12
Keycode 124 = F13
Keycode 125 = F14
Keycode 126 = F15
Keycode 127 = F16
Keycode 128 = F17
Keycode 129 = F18
Keycode 130 = F19
Keycode 131 = F20
Keycode 132 = F21
Keycode 133 = F22
Keycode 134 = F23
Keycode 135 = F24
Keycode 136 = Num_Lock
Keycode 137 = Scroll_Lock
Keycode 187 = acute grave
Keycode 188 = comma semicolon
Key code 189 = minus underscore
Key code 190 = period colon
Key code 192 = numbersign apostrophe
Key Code 210 = plusminus hyphen macron
Key code 211 =
Key code 212 = copyright registered
Key code 213 = guillemotleft guillemotright
Keycode 214 = masculine ordfeminine
Keycode 215 = AE AE
Keycode 216 = cent yen
Key code 217 = questiondown exclamdown
Key code 218 = onequarter onehalf threequarters
Keycode 220 = less greater bar
Key code 221 = plus asterisk asciitilde
Key code 227 = multiply division
Keycode 228 = acircumflex Acircumflex
Key code 229 = ecircumflex Ecircumflex
Keycode 230 = icircumflex Icircumflex
Key code 231 = ocircumflex Ocircumflex
Keycode 232 = ucircumflex Ucircumflex
Keycode 233 = ntilde Ntilde
Keycode 234 = yacute Yacute
Key code 235 = oslash Ooblique
Key Code 236 = aring Aring
Keycode 237 = ccedilla Ccedilla
Key code 238 = thorn THORN
Keycode 239 = eth ETH
Key code 240 = diaeresis cedilla currency
Key code 241 = agrave Agrave atilde Atilde
Keycode 242 = egrave Egrave
Keycode 243 = igrave Igrave
Key code 244 = ograve Ograve otilde Otilde
Keycode 245 = ugrave Ugrave
Keycode 246 = adiaeresis Adiaeresis
Keycode 247 = ediaeresis Ediaeresis
Keycode 248 = idiaeresis Idiaeresis
Keycode 249 = odiaeresis Odiaeresis
Keycode 250 = udiaeresis Udiaeresis
Key code 251 = ssharp question backslash
Keycode 252 = asciicircum degree
Keycode 253 = 3 sterling
Keycode 254 = Mode_switch
Use
<Script language = "javascript">
Function keyevent (){
If (event. keyCode = 13)
Alert ("# $ % # ^ % ");
}
Document. onkeydown = keyevent;
</Script>
Event. The keyCode value is 37, 38, 39, and 40. The cursor of the corresponding pressed direction is left, top, right, bottom.

"Javascript: if (event. keyCode <45 | event. keyCode> 57) event. returnValue = false ;");

If (event. keycode = 13) indicates that the press is the Enter key.

"Javascript: if (event. keyCode> 45 & event. keyCode <57) event. returnValue = false ;");
<Html> <pead> </pead> <body> // Javascript Document <center> press any key .... </Center> </body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
**************************************** ******************************
Use javascript to intercept keyboard input on the WEB page
Use the keyCode attribute of the event object to determine the Input key value
Eg: if (event. keyCode = 13) alert ("enter !");
Key value table
A 0X65 U 0X85
B 0X66 V 0X86
C 0X67 W 0X87
D 0X68X0X88
E 0X69 Y 0X89
F 0X70 Z 0X90
G 0X71 0 0X48
H 0X72 1 0X49
I 0X73 2 0X50
J 0X74 3 0X51
K 0X75 4 0X52
L 0X76 5 0X53
M 0X77 6 0X54
N 0X78 7 0X55
O 0X79 8 0X56
P 0X80 9 0X57
Q 0X81 ESC 0X1B
R 0X82 CTRL 0X11
S 0X83 SHIFT 0X10
T 0X84 ENTER 0XD

If you want to use the combination key, you can use event. ctrlKey, event. shiftKey, event. altKey to determine whether ctrl, shift, and alt keys are pressed.

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.