Guest parvez Posted February 5, 2009 Share Posted February 5, 2009 How to block the alt key for a browser using javascript. Link to comment Share on other sites More sharing options...
jeffman Posted February 5, 2009 Share Posted February 5, 2009 You should explain more. What are you trying to accomplish?If you want to block the browser's own menu items, it won't work. The system intercepts all keystrokes before passing them to the application. Then the application intercepts keystrokes before passing them to the document event manager.If you simply want to test for the alt-key, this will work:element.onkeydown = function (e) { e = e || window event; k = e.keyCode; if (e.altKey) { // DO SOMETHING }}[/code]If you return false from the function, you will intercept the key event. If you return true, the key event will pass to the next handler on the schedule. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.