document.addEventListener('keydown', function(e){
if (e.keyCode == 86 && e.ctrlKey) {
alert("你按下了ctrl+V");
}
if (e.keyCode == 86 && e.altKey) {
alert("你按下了alt+V");
}
if (e.keyCode == 86 && e.shiftKey) {
alert("你按下了shift+V");
}
if (e.keyCode == 83 && e.ctrlKey){
alert('saved1');
e.preventDefault();
alert('saved');
}
if (e.keyCode == 83 && e.ctrlKey && e.shiftKey) {
alert("你按下了ctrl+shift+S");
}
if (e.keyCode == 13&&e.ctrlKey) {
alert("你按下了ctrl+回车");
return;
}
if (e.keyCode == 13) {
alert("你按下了回车");
}
});
keyCode 65 = a 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 at
keyCode 82 = r R
keyCode 83 = s S
keyCode 84 = t T
keyCode 85 = u U
keyCode 86 = v V
keyCode 87 = w W
keyCode 88 = x X
keyCode 89 = y Y
keyCode 90 = z Z
//第一行
keyCode 27 = Esc
keyCode 112 = F1
keyCode 113 = F2
keyCode 114 = F3
keyCode 115 = F4
keyCode 116 = F5
keyCode 117 = F6
keyCode 118 = F7
keyCode 119 = F8
keyCode 110 = F9
keyCode 121 = F10
keyCode 122 = F11
keyCode 123 = F12
keycode 42 = Print
keycode 137 = Scroll_Lock
keycode 19 = Pause
//第二行
keycode `~ = 192
keycode 48 = 0 )
keycode 49 = 1 !
keycode 50 = 2 @
keycode 51 = 3 #
keycode 52 = 4 $
keycode 53 = 5 %
keycode 54 = 6 ^
keycode 55 = 7 &
keycode 56 = 8 *
keycode 57 = 9 (
keycode 187 = =+
keycode 189 = -_
keycode 8 = BackSpace
//其他特殊符号
keycode 9 = Tab
keycode 20 = Caps_Lock(大写锁定)
e.shiftKey
e.ctrlKey
e.altKey
keycode 32 = Space(空格键)
keycode 13 = Enter(回车)
keycode 219 = [{
keycode 220 = \|
keycode 221 = ]}
keycode 222 = '"
keycode 188 = ,<
keycode 190 = .>
keycode 191 = /?
keycode 45 = Insert
keycode 46 = Delete
keycode 36 = Home
keycode 35 = End
keycode 33 = Page Up
keycode 34 = Page Down
keycode 37 = Left(左箭头)
keycode 38 = Up(上箭头)
keycode 39 = Right(右箭头)
keycode 40 = Down(下箭头)
数字键盘
keycode 96 = 0 (数字0)
keycode 97 = 1 (数字1)
keycode 98 = 2 (数字2)
keycode 99 = 3 (数字3)
keycode 100 = 4 (数字4)
keycode 101 = 5 (数字5)
keycode 102 = 6 (数字6)
keycode 103 = 7 (数字7)
keycode 104 = 8 (数字8)
keycode 105 = 9 (数字9)
keycode 106 = *
keycode 107 = +
keycode 108 = Enter
keycode 109 = -
keycode 110 = .
keycode 111 = /
浏览量: 839