I was having a play with this script.
And I noticed that Alt Gr's KeyCode is 17 in IE10 and 17 AND 18 in Chrome?
Can someone explain why its not 18 (or a completely new number) and why I get two popups in Chrome?
Heres the code:
document.onkeyup = KeyCheck;
function KeyCheck(e) {
var KeyID = (window.event) ? event.keyCode : e.keyCode;
alert(KeyID);
switch (KeyID)
{
case 18:
document.Form1.KeyName.value = "Alt";
break;
case 17:
document.Form1.KeyName.value = "Ctrl";
break;
}
}
This is not my code, I just stumbled upon it.
EDIT: Having more of a play around I believe Alt Gr means Ctrl + Alt at the same time, as some things that require Alt Gr like é also work with Ctrl + Alt.
AltGr
===CTRL
+ALT
, though after your edit looks like you know that already. Looks like Chrome triggers both pressed, when pressingAltGr
.alert
, and change it to append to the form, the firstalert
seems to stop the secondonkeyup
from firing).AltGr
is a different keycode, namely 225 (Ctrl
: 17,Alt
: 18).