js键盘事件编码

项目经常会用到键盘快捷方式,需要使用键盘编码,下面根据网上找到的资料,整理如下:

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


  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值