1

I built a game and i am using the arrow keys to move and space bar to shoot and it keeps forcing it down to the bottom of the web page every time i hit the down key or space bar is there any way to modify the CSS to make it focus on the game div tag and not scroll???

4

1 に答える 1

7

You are failing to cancel the event. If it's an inline event, just return false; at the end of it. If it's done with addEventListener, call Event.preventDefault() and return false;.

于 2013-01-25T23:55:10.817 に答える