数字小键盘的键码

Keycodes for the Numeric Keypad

我正在查看 Stack Overflow 问题,看看是否有数字小键盘(键盘右侧的键)的键码。给出了有用的答案列表,但也令人困惑。显然 Numpad-0 是 96,Numpad-1 是 97,Numpad-2 是 98,依此类推。

这还行,只是97不是已经分配给资本A,98已经分配给资本B了吗?

有人可以帮忙吗?

Javascript Keycodes 不同于 ASCII 码(在 javascript 中称为 Character Codes)可悲的是,因为 ASCII 不区分键盘顶部的 1 和数字键盘上的 1 - 它们是相同的字符。同样,javascript 键码不区分大写字母和小写字母,因为它们是相同的键...

此处显示 ASCII 代码:http://www.asciitable.com/index/asciifull.gif

和 Javascript 关键代码在这里:https://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes

本页(https://www.w3schools.com/jsref/event_key_keycode.asp)描述了差异;

两种码型的区别:

Character codes - A number which represents an ASCII character

Key codes - A number which represents an actual key on the keyboard

These types do not always mean the same thing; for example, a lower case "w" and an upper case "W" have the same keyboard code, because the key that is pressed on the keyboard is the same (just "W" = the number "87"), but a different character code because the resulting character is different (either "w" or "W", which is "119" or "87") - See "More Examples" below to better understand it.