1UnitedPower: Pfeiltasten: hoch/runter werden nicht ausgewertet

Beitrag lesen

<http://de.selfhtml.org/javascript/objekte/event.htm#key_code@title=Über keyCode>
<http://de.selfhtml.org/javascript/objekte/event.htm#which@title=Über which>
kleine Stütze

Mehr Code:

function keyPressed(event){
            event = event || window.event;

if(event.keyCode == 65) //left (a)
              key = 0;
            else if(event.keyCode == 87) //up (w)
              key = 1;
            else if(event.keyCode == 68) //right (d)
              key = 2;
          }

document.onkeypress = keyPressed;