Forum

Yampiz Forum

Sharing let knowledge Spreaded, Reading let spirits growth, Creative let culture extended, Let us
  • 禁止廣告文
  • 知識傳播
  • 閱讀
  • 心靈成長
  • 創作
  • 文化傳承
Forum Dictionary / Programming / 網頁/網站程式 / JavaScript /

javascript 取得按鍵碼

New Subject
Random
Previous
Next
|
javascript 取得按鍵碼

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

使用 event 對象的 keyCode 屬性判斷輸入的鍵值 eg:if(event.keyCode==13)alert(「enter!」);

鍵值對應表

A 0X65  U 0X85
B 0X66 V  X86
C 0X67 W  X87
D 0X68 X 0X88
E 0X69 Y  X89
F 0X70 Z  X90
G 0X71 0  X48
H 0X72 1  X49
I 0X73 2  X50
J 0X74 3 0X51
K 0X75 4 0X52
L 0X76 5 0X53
M 0X77 6  X54
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

如果要使用組合鍵,則可以利用event.ctrlKey,event.shiftKey,event .altKey 判斷是否按下了ctrl 鍵、shift 鍵以及alt 鍵。

  • Keywords : event, keyCode, 鍵值, space, KP_Subtract, KP_Separator, KP_Multiply, KP_Divide, KP_Decimal, KP_Add, Escape, BackSpace, 鍵以及alt, 應表, 否按下, 判斷, 使用, yacute, underscore, ugrave
0 0
2010-07-21T15:23:00+0000


  • Now, you can post comments by Facebook Account when your Yampiz account was logout or unvariable. whatever, we suggest to post comment by Yampiz Account to get more bounds to join new events of Heyxu
Comment
 
Verify

Facebook Page

QR-Code and APP Launcher

User Guide
This Webpage

In those service tabs, "Scan QRCode, in mobile device" or "Click the button, in this device" to open webpage or APP-related operations.
QRCode
  • Auto Platform
    For better browsing experience, it will auto detects your device to display webpage.
  • Bug Report
    Tell us about the idea, problem and errors you found.
  • Comodo Secure
    The sensitive data transmission adopts by SSL-2048 authenticated encryption.
  • Copyright
    © 2009 YamPiz Digital Inc. & Jaby Group. All rights reserved.
  • Revised Version
    V2.2.197
    29 Oct 2024 (GMT+8)