I'm trying to use the onKeyDown event on a text field. I intersept the
keystroke, interpret it and then do certain actions based on certain
keys stuck. If a special key is stuck I replace the value in the text
field and return false. This seems to say "get rid of the key struck - I
handled it instead" for IE but not for Netscape.
I set up a page, http://defaria.com/test.html to demonstrate this. If
you type any character it is simply inserted. If you type a "t",
however, the field is replaced with the current date. In IE this works
just fine. In Netscape I get the current date followed by the "t"
character! Trying to debug this I inserted an alert into the code. The
strange thing is that with the alert Netscape stops appending the "t"!
This is demonstrated by http://defaria.com/test.html under Netscape
(actually I'm using Firefox). The first box, labelled SetToday1, will
pop up an alert box for any key you type. Again if you type "t" the
current date is inserted and "t" is *not* appended to the date inserted.
The second box, labelled SetToday2, will not pop up an alert box but it
functions similarly in that typing a "t" will insert the current date.
However, SetToday2, without the call to alert, will append a "t" to the
date inserted even though false is being returned. This happens only on
Netscape and not on IE. The question is why?
(To view the source use *View: Source*)
--
When something is "new and improved!". Which is it? If it's new, then
there has never been anything before it. If it's an improvement, then
there must have been something before it.