js快捷键设置

<script>

document.onkeyup=function(event){

  var e=event||window.event;

  var keyCode=e.keyCode||e.which;

  switch(keyCode){

    case 112:

      //do your things.............

      break;      

    case 113:

      //do your things.............

      break;      

    ....

    ....

  }

 

}

</script>

 

 

keyCode:

 

BACK SPACE:8

TAB:9

SHIFT:16

CTRL:17

ALT:18

PAUSE:19

CAPS LOCK:20

ESC:27

SPACE:32

PGUP:33

PGDN:34

END:35

HOME:36

←:37

↑:38

→:39

↓:40

INS:45

DEL:46

0:48

1:49

2:50

3:51

4:52

5:53

6:54

7:55

8:56

9:57

A:65

B:66

C:67

D:68

E:69

F:70

G:71

H:72

I:73

J:74

K:75

L:76

M:77

N:78

O:79

P:80

Q:81

R:82

S:83

T:84

U:85

V:86

W:87

X:88

Y:89

Z:90

WINDOWS:91

F1:112

F2:113

F3:114

F4:115

F5:116

F6:117

F7:118

F8:119

F9:120

F10:121

F11:122

F12:123

NUM LOCK:144

SCR/LOCK:145

;:186

=:187

,:188

-:189

.:190

/:191

~:192

[:219

]:221

\:220

':222

 

你可能感兴趣的:(快捷键)