Keyboard events handling nightmare!!
By Vincent DEMAY, Thursday 2 August 2007 :: Wicket :: #70 :: rss
Handling keyboard events is a real nightmare. If you want connect some keyboard events, this page can be usefull : http://unixpapa.com/js/key.html.
Moreover, you need to know Internet Explorer and firefox do no handle event on the same way:
firefox
ie
So to deal with that mess you need to do
Moreover, you need to know Internet Explorer and firefox do no handle event on the same way:
firefox
myDomNode.onkeypress = function(event) { alert(event.keyCode)}
ie
myDomNode.onkeypress = function() { alert(window.event.keyCode)}
Actually IE propage key event on window.
So to deal with that mess you need to do
myDomNode.onkeypress = function(event) {if (!event){event = window.event;} alert(event.keyCode);}
Power by
Comments
1. Le Friday 3 August 2007 , par jbq
2. Le Monday 20 August 2007 , par ph
Add a comment