用于windows键盘按键的ascii代码和用于功能键(F1-F12)的代码以及诸如shift,capslock,backspace,ctrl等的其他键 [英] ascii codes for windows keyboard keys and the codes for function keys(F1 - F12) and other keys like shift,capslock,backspace,ctrl etc

查看:355
本文介绍了用于windows键盘按键的ascii代码和用于功能键(F1-F12)的代码以及诸如shift,capslock,backspace,ctrl等的其他键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是一个Windows键盘:

p>



从哪里可以获取代码?如果我用十六进制表示法得到代码将会很好。

解决方案

这可能为时已晚,但我有一个解决方案。可以通过在浏览器的控制台中运行(注入)以下JavaScript代码来获得所有 keyCode 值(即使是功能键)。只需粘贴以下代码并按Enter即可。然后单击任意位置在页面中从控制台中移除光标。

然后按任何你想要keyCode为十六进制的键

下面是代码:

  document.addEventListener(keydown,function(e){
code =(e.keyCode);
console.log(In decimal+ e.keyCode);
var hex = code.toString(16);
console.log(In Hex + hex);
},false);


To write a keyboard related application I wanted the list of the ASCII codes of the keys that I have on my keyboard.

It is a windows keyboard :

From where can I get the codes ? It will be great if I get the codes in hexadecimal notation.

解决方案

This maybe too late,but I have a solution.You may get all the keyCode values (Even for Function keys) by running (injecting) following JavaScript code into your browser's console.simply paste the following code and press enter.Then click anywhere in the page to remove the cursor from the console.

Then press any key for which you want a keyCode in Hex

Here is the code :

    document.addEventListener("keydown", function (e) {
      code = (e.keyCode);
      console.log("In decimal "+e.keyCode);
      var hex = code.toString(16);
      console.log("In hex "+hex);
    }, false);

这篇关于用于windows键盘按键的ascii代码和用于功能键(F1-F12)的代码以及诸如shift,capslock,backspace,ctrl等的其他键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆