用于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
问题描述
这是一个Windows键盘:
p>
从哪里可以获取代码?如果我用十六进制表示法得到代码将会很好。
解决方案这可能为时已晚,但我有一个解决方案。可以通过在浏览器的控制台中运行(注入)以下JavaScript代码来获得所有 keyCode
值(即使是功能键)。只需粘贴以下代码并按Enter即可。然后单击任意位置在页面中从控制台中移除光标。
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屋!