Key Codes for some keyboard buttons

A

Additya

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
 
T

Thomas 'PointedEars' Lahn

Additya said:
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
 
D

David Mark

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.
 
T

Thomas 'PointedEars' Lahn

David said:
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
 
D

David Mark

Scott said:
[H]ave I ever failed to surprise?

Continually.

What is obvious to some is often surprising to others.
Of course you could shock everyone here by endorsing
MooTools! :)

Now that would be a surprise. Mootools is just another 50-100K of JS
that is _constantly_ changed by various deluded hacks and occasionally
crystallizes into something that appears to work in three or four of the
latest browsers (in their default configurations). How is that worth...
anything? And it's a _really_ stupid name too. I'm trying to imagine
corporate IT types dropping that into a conversation. Can't do it.
 
T

Thomas 'PointedEars' Lahn

David said:
Why? I don't need help with it. :)

I don't think you ... wait, this thread is at the verge of getting
recursive. We better end it while we still can.
How would you know?

You have not read the article yet.
What did I advertise

That your code/My Library can do "cross-browser keyboard monitoring".
and have I ever failed to surprise?

No; sometimes unfortunately.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top