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);
}
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.
This is the same for other keys as well, for example, 's' for me is 115, but everyone else states that 's' is 83.
Is there a dependency that i'm missing? If i fire an event assuming a == 95, will it work on other browsers?
Thanks.
So I found that a capital A
is indeed, 65.
A lowercase a
is 97
Please see this chart:
Chart original location: http://www.asciitable.com/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With