zoukankan      html  css  js  c++  java
  • javascript判断键盘按键

    window.document.onkeydown = disableRefresh;
    function disableRefresh(evt){
    evt = (evt) ? evt : window.event
    if (evt.keyCode) {
       if(evt.keyCode == 116){
         //do something
       }
    }
    }
    keycode 8 = BackSpace BackSpace
    keycode 9 = Tab 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 Escape
    keycode 32 = space 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 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
  • 相关阅读:
    spark基础(1)
    Homebrew的使用教程,镜像源的推荐,安装软件的方法
    Scala Trait(特征)
    P5308 [COCI2019] Quiz
    Vjudge contest 425291
    Vjudge contest 424925
    AT3558 Modern Painting
    Vjudge contest 425061
    Vjudge contest 423849
    Codeforces Round 704
  • 原文地址:https://www.cnblogs.com/akatuki/p/4045522.html
Copyright © 2011-2022 走看看