Copy Code code as follows:
KeyCode 8 = BackSpace BackSpace
KeyCode 9 = Tab tab
KeyCode = Clear
KeyCode = Enter
KeyCode = shift_l
KeyCode = control_l
KeyCode = alt_l
KeyCode = Pause
KeyCode = Caps_lock
KeyCode = Escape escape
KeyCode = Space Spaces
KeyCode = Prior
KeyCode = Next
KeyCode = End
KeyCode = Home
KeyCode (Panax) = Left
KeyCode = up
KeyCode = Right
KeyCode = Down
KeyCode = Select
KeyCode = Print
KeyCode = Execute
KeyCode = Insert
KeyCode = Delete
KeyCode = Help
keycode = 0 Equal braceright
keycode = 1 Exclam onesuperior
KeyCode = 2 Quotedbl twosuperior
KeyCode Wuyi = 3 section Threesuperior
keycode = 4 Dollar
KeyCode = 5 percent
KeyCode = 6 Ampersand
keycode = 7 Slash braceleft
KeyCode = 8 Parenleft bracketleft
KeyCode = 9 Parenright bracketright
KeyCode = a A
KeyCode = b b
KeyCode = c C
KeyCode = d D
KeyCode = e e eurosign
KeyCode = f F
KeyCode = g g
KeyCode = h H
KeyCode = i I
KeyCode-J J
KeyCode = k K
KeyCode = l l
keycode = M M mu
KeyCode = n N
keycode = o O
KeyCode = P p
KeyCode Bayi = q q at
KeyCode = r R
KeyCode-S S
KeyCode = t T
KeyCode = u u
KeyCode = v V
KeyCode = w W
KeyCode = x x
keycode) = y y
KeyCode = Z Z
KeyCode = Kp_0 Kp_0
KeyCode Kp_1 kp_1
KeyCode = kp_2 kp_2
KeyCode = Kp_3 Kp_3
KeyCode = Kp_4 Kp_4
KeyCode = Kp_5 Kp_5
KeyCode 102 = Kp_6 Kp_6
KeyCode kp_7 kp_7
KeyCode = Kp_8 Kp_8
KeyCode = Kp_9 Kp_9
KeyCode kp_multiply kp_multiply
KeyCode = Kp_add Kp_add
KeyCode 108 = Kp_separator Kp_separator
KeyCode 109 = kp_subtract Kp_subtract
KeyCode = Kp_decimal Kp_decimal
KeyCode = Kp_divide Kp_divide
KeyCode 112 = F1
KeyCode 113 = F2
KeyCode 114 = F3
KeyCode = F4
KeyCode 116 = F5
KeyCode 117 = F6
KeyCode 118 = F7
KeyCode 119 = F8
KeyCode = F9
KeyCode 121 = F10
KeyCode 122 = F11
KeyCode 123 = F12
KeyCode 124 = F13
KeyCode = F14
KeyCode 126 = F15
KeyCode 127 = F16
KeyCode 128 = F17
KeyCode 129 = F18
KeyCode 130 = F19
KeyCode 131 = F20
KeyCode 132 = F21
KeyCode-F22
KeyCode 134 = F23
KeyCode 135 = F24
KeyCode 136 = Num_lock
KeyCode 137 = Scroll_lock
KeyCode 187 = Acute grave
KeyCode 188 = Comma semicolon
KeyCode 189 = minus underscore
KeyCode 190 = Period Colon
KeyCode numbersign Apostrophe
KeyCode 210 = Plusminus hyphen Macron
KeyCode 211 =
KeyCode 212 = Copyright Registered
KeyCode 213 = Guillemotleft Guillemotright
KeyCode 214 = masculine Ordfeminine
KeyCode 215 = AE AE
KeyCode 216 = cent yen
KeyCode 217 = Questiondown Exclamdown
KeyCode 218 = Onequarter Onehalf threequarters
KeyCode less Greater Bar
KeyCode 221 = plus asterisk Asciitilde
keycode = Multiply Division
KeyCode 228 = Acircumflex Acircumflex
KeyCode 229 = Ecircumflex Ecircumflex
KeyCode 230 = Icircumflex Icircumflex
KeyCode 231 = Ocircumflex Ocircumflex
KeyCode 232 = Ucircumflex Ucircumflex
KeyCode 233 = Ntilde Ntilde
KeyCode 234 = Yacute Yacute
KeyCode 235 = Oslash Ooblique
KeyCode 236 = aring aring
KeyCode 237 = Ccedilla Ccedilla
KeyCode 238 = Thorn Thorn
KeyCode 239 = ETH ETH
KeyCode = diaeresis cedilla currency
KeyCode 241 = Agrave Agrave Atilde Atilde
KeyCode 242 = Egrave Egrave
KeyCode 243 = Igrave Igrave
KeyCode 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 = Udiaeresis udiaeresis
KeyCode 251 = ssharp question Backslash
KeyCode 252 = Asciicircum Degree
KeyCode 253 = 3 Sterling
KeyCode 254 = Mode_switch
Use
Copy Code code as follows:
<script language= "JavaScript" >
function KeyEvent () {
if (event.keycode==13)
Alert ("#$%#%# ^^%");
}
Document.onkeydown = KeyEvent;
</script>
Event.keycode value is the direction of the 37,38,39,40 is left, up, right, down
"Javascript:if (Event.keycode < 45 | | Event.keycode >) Event.returnvalue = false; ");
if (event.keycode==13) means that the carriage return keyboard is pressed
"Javascript:if (Event.keycode > && event.keycode <) Event.returnvalue = false;");
<ptml> <!--//this code by hongseheike--> <pead> <script language= "JavaScript" > ns4 = (docume nt.layers)? True:false; ie4 = (document.all)? True:false; function KeyDown (e) {if (ns4) {var Nkey=e.which; var iekey= ' is now NS browser '; var realkey=string.fromcharcode (E.which); } if (ie4) {var iekey=event.keycode; var nkey= ' is now IE browser '; var realkey=string.fromcharcode (Event.keycode); if (event.keycode==32) {realkey= ' \ ' space \ '} if (event.keycode==13) {realkey= ' \ carriage return \ '} if (event.keycode==27) {realkey= ' \ ' Esc\ '} if (event.keycode==16) {realkey= ' \ shift\ '} if (event.keycode==17) {realkey= ' \ ' ctrl\ '} if (event.keycode== {realkey= ' \ alt\ '}} alert (key value in ' NS browser: ' +nkey+ ' \ n ' + ' + ') key value: ' +iekey+ ' \ n ' + ' actual key is ' +realkey '); } Document.onkeydown = KeyDown; if (NS4) {document.captureevents (event.keydown);} </script> </pead> <body>//javascript Document <pr> <center> <p> Please press any key .... </p> </center> </body> </pTml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
**********************************************************************
Using JavaScript to intercept keyboard input in a Web page
Use the KeyCode property of the event object to determine the key value entered
eg:if (event.keycode==13) alert ("enter!");
Corresponding Table of key value
a 0x65 U 0x85
b 0x66 V 0x86
c 0x67 W 0X87
d 0x68 X 0x88
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 a key combination, you can use Event.ctrlkey,event.shiftkey,event. Altkey to determine whether the CTRL key, SHIFT, and ALT keys are pressed