Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #14603

Re: keycode

Message-ID <9717015.O9o76ZdvQC@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2012-06-21 20:08 +0200
Subject Re: keycode
Newsgroups comp.lang.javascript
References <jrv9ht$d3e$1@speranza.aioe.org> <XnsA079A4362D14Ceejj99@194.109.133.133> <jrvbc0$i8k$1@speranza.aioe.org> <1598379.oMNUckLgyt@PointedEars.de> <jrvkel$b8t$1@speranza.aioe.org>
Followup-To comp.lang.javascript

Followups directed to: comp.lang.javascript

Show all headers | View raw


Phil Hunt wrote:

>  "basic DOM knowledge" and then "most difficult tasks in DOM programming"
> ???
> Which one is it ?

Both.  Keyboard events are part of basic DOM knowledge indeed, but it is 
very difficult to make use of them because there are so many different 
implementations.

> I mostly pretend to do .net asp, but I just need this jscript this time
                                                        ^^^^^^^
You should have said so from the start.  Microsoft's implementation of 
ECMAScript is called JScript, BTW (although at least in the MSDN Library 
they have jumped the "JavaScript" meme bandwagon recently), and it has 
little to do with the DOM implementation you are programming for, the MSHTML 
DOM.  But from your code it looks as if that was not the end of it.

> I google with 'event.keycode' to come up with
> 
> {
> if(window.event) // IE8 and earlier
>  {
>  keynum = e.keyCode;
>  }
> else if(e.which) // IE9/Firefox/Chrome/Opera/Safari

Ouch.  Attributing different DOM behavior to different browsers (instead of 
different DOMs) – this is where misconceptions begin in this field.

>  {
>  keynum = e.which;
>  }

This code could use a bit of Pretty Printing.
 
> It works, that's all I know

It works for some keys, but not others, to begin with.  See the references
I have provided.

> "Thomas 'PointedEars' Lahn" <PointedEars@web.de> wrote in message
> news:1598379.oMNUckLgyt@PointedEars.de...
>> […]

Would you *please* stop top-posting?  And please fix your From header field 
and skip the attribution novel while you are at it.  <http://insideoe.com/>


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@news.demon.co.uk>

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

keycode "Phil Hunt" <aaa@aaa.com> - 2012-06-21 09:54 -0400
  Re: keycode "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-06-21 14:08 +0000
    Re: keycode "Phil Hunt" <aaa@aaa.com> - 2012-06-21 10:25 -0400
      Re: keycode "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-06-21 14:50 +0000
        Re: keycode "Phil Hunt" <aaa@aaa.com> - 2012-06-21 11:00 -0400
          Re: keycode "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-06-21 16:30 +0000
          Re: keycode Arno Welzel <usenet@arnowelzel.de> - 2012-06-27 17:31 +0200
      Re: keycode Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-06-21 18:28 +0200
        Re: keycode "Phil Hunt" <aaa@aaa.com> - 2012-06-21 13:00 -0400
          Re: keycode Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-06-21 20:08 +0200

csiph-web