Prev: control a form submit
Next: How to get the html elements of Iframe from the Parent page by javascript
From: Additya on 22 Jan 2010 02:03 This tutorial will show you how to get the pressed key in the browser window, whether it's Ctrl, Alt, Shift, Page Up, Arrow Up or any other key. There's both an Internet Explorer and a Firefox way of doing this. http://www.ezdia.com/Key_Codes_for_some_keyboard_buttons/Content.do?id=782 There are several reasons why you may want to capture the key press event in a browser window. Perhaps you're making a JavaScript game, or a map similar to Google Maps and you want to allow navigation through the arrow keys. Getting the pressed key is easy in JavaScript, however different browsers use different ways for this
From: Thomas 'PointedEars' Lahn on 22 Jan 2010 06:05 Additya wrote: > This tutorial will show you how to get the pressed key in the browser > window, whether it's Ctrl, Alt, Shift, Page Up, Arrow Up or any other > key. There's both an Internet Explorer and a Firefox way of doing > this. > > http://www.ezdia.com/Key_Codes_for_some_keyboard_buttons/Content.do?id=782 Utter nonsense. Ctrl, Alt, and Shift are detected with the ctrlKey, altKey, and shiftKey event properties respectively, `keyCode' is not reliable, proprietary event-handler properties are used, Opera or WebKit are not considered at all, proprietary control referencing is used, and the markup is invalid XHTML or HTML. Oh yes, and code written 2005(!) to handle "Internet Explorer and Firefox" is very relevant today, isn't it? Of course, none of the half-wits replying there could have possibly recognized any of that, only that it would be "working well" (it doesn't) or that it "(still) does not work" (of course it doesn't). Blind leading the blind. For getting a good idea and rather up-to-date information on how hard it really is to handle keyboard events cross-DOM/cross-browser, read <http://unixpapa.com/js/key.html> instead. PointedEars -- Use any version of Microsoft Frontpage to create your site. (This won't prevent people from viewing your source, but no one will want to steal it.) -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
From: David Mark on 22 Jan 2010 10:11 Thomas 'PointedEars' Lahn wrote: [...] > > For getting a good idea and rather up-to-date information on how hard it > really is to handle keyboard events cross-DOM/cross-browser, read > <http://unixpapa.com/js/key.html> instead. > I haven't read the article, but I can tell you it isn't hard to do cross-browser keyboard monitoring. I had never had a call for it until recently and was pleasantly surprised at how trivial it turned out to be. Yes, that script will likely end up in My Library as attachKeyboardListeners (or something like that). It is already part of the upcoming sequel.
From: Thomas 'PointedEars' Lahn on 22 Jan 2010 10:42 David Mark wrote: > Thomas 'PointedEars' Lahn wrote: >> For getting a good idea and rather up-to-date information on how hard it >> really is to handle keyboard events cross-DOM/cross-browser, read >> <http://unixpapa.com/js/key.html> instead. > > I haven't read the article, You should. > but I can tell you it isn't hard to do cross-browser keyboard monitoring. I don't think you are already in a position to make that assessment. > I had never had a call for it until recently and was pleasantly surprised > at how trivial it turned out to be. Yes, that script will likely end up > in My Library as attachKeyboardListeners (or something like that). It is > already part of the upcoming sequel. I'd be positively surprised if it did as advertised. PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs, <f806at$ail$1$8300dec7(a)news.demon.co.uk>
From: David Mark on 22 Jan 2010 11:09 Thomas 'PointedEars' Lahn wrote: > David Mark wrote: > >> Thomas 'PointedEars' Lahn wrote: >>> For getting a good idea and rather up-to-date information on how hard it >>> really is to handle keyboard events cross-DOM/cross-browser, read >>> <http://unixpapa.com/js/key.html> instead. >> I haven't read the article, > > You should. Why? I don't need help with it. :) > >> but I can tell you it isn't hard to do cross-browser keyboard monitoring. > > I don't think you are already in a position to make that assessment. How would you know? > >> I had never had a call for it until recently and was pleasantly surprised >> at how trivial it turned out to be. Yes, that script will likely end up >> in My Library as attachKeyboardListeners (or something like that). It is >> already part of the upcoming sequel. > > I'd be positively surprised if it did as advertised. > What did I advertise and have I ever failed to surprise?
|
Next
|
Last
Pages: 1 2 Prev: control a form submit Next: How to get the html elements of Iframe from the Parent page by javascript |