a的Java代码:65还是97? [英] Javascript Keycode for a: 65 or 97?

查看:72
本文介绍了a的Java代码:65还是97?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Chrome浏览器使用javascript(在Macbook pro OSX 10.11.x上,不确定是否很重要).我正在使用该功能:

I'm working with javascript (on a macbook pro OSX 10.11.x, not sure if this matters) using Chrome browser. Im using the function:

window.onkeypress = function(e) {
    var key = e.keyCode ? e.keyCode : e.which;
    console.log("keypressed = " + key);
}

当我按下键盘上的"a"键时,其记录为97,但这与我在互联网上找到的任何其他keyCode列表都不对应,其中指出"a"为65.

when i press 'a' key on my keyboard, it logs as 97, however this does not correspond to any other keyCode list i find on the internet, which states 'a' is 65.

其他键也是如此,例如,对于我来说,"s"是115,但是其他所有人都说"s"是83.

This is the same for other keys as well, for example, 's' for me is 115, but everyone else states that 's' is 83.

我是否缺少依赖项?如果我假设某个事件== 95,那么它将在其他浏览器上正常工作吗?

Is there a dependency that i'm missing? If i fire an event assuming a == 95, will it work on other browsers?

谢谢.

推荐答案

所以我发现大写的 A 确实是65.

So I found that a capital A is indeed, 65.

小写的 a 是97

请参见以下图表:

图表原始位置: http://www.asciitable.com/

这篇关于a的Java代码:65还是97?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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