开发者

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.


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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜