Robert Hurst
Robert Hurst

Reputation: 9092

Binding keys with javascript while preventing the browser shortcut keys

I'm making a javascript game and need to bind a lot of keys to different functions. This I know how to do, what I need some help on is over-riding the shortcut keys for the browser. in other-words I want to blur hot keys for the browser and divert them to my application.

Upvotes: 2

Views: 1098

Answers (1)

Jacob Relkin
Jacob Relkin

Reputation: 163238

I believe that if you stop the propogation of the event, then you will prevent the browser from catching the event.

an example of this:

element.onkeyup = function(e) {
   var ev = e || event;
   //do stuff here, probably with ev.keyCode

   return false;
}

Upvotes: 1

Related Questions