javascript - Why does Alt Gr have the same keyCode as Ctrl? -


i having play script.

and noticed alt gr's keycode 17 in ie10 , 17 , 18 in chrome?

can explain why not 18 (or new number) , why 2 popups in chrome?

heres 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 not code, stumbled upon it.

edit: having more of play around believe alt gr means ctrl + alt @ same time, things require alt gr é work ctrl + alt.

the problem alert halts execution of code, second onkeyup not called. changing function to

function keycheck(e) {     var keyid = (window.event) ? event.keycode : e.keycode;     switch(keyid)     {     case 18:         document.form1.keyname.value = document.form1.keyname.value+"alt";         break;      case 17:         document.form1.keyname.value = document.form1.keyname.value+"ctrl";         break;     } } 

we can see both alt , ctrl called.

tested firefox 22 , ie 9.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -