Hi Fred,
Did you ever find a solution for this? I am now encountering the same
problem. We want to cancel non-numeric characters and have found a way to
do it that is supported by both IE6 and NS7 - onKeyPress event with a
handler that returns false (or sets event.returnVal ) if not numeric. Now
I'm trying to get it to work with Safari and it just won't. The onKeyPress
event fires, the handler is called, returns false appropriately, but doesn't
cancel the key. Since it has a window.event like IE, I tried setting
returnVal to false - nada. I tried setting event.keyCode to something
else - nada. I tried overriding the value of the object - nada.
Anyone have any ideas? Your help is greatly appreciated!
Julia Allen
ju********@delt ek.com
"Fred Brown" <fr***@inter.ne t.il> wrote in message
news:45******** *************** ***@posting.goo gle.com...
Peter,
I checked if I could cancel the onKeyDown on Safari and I could not.
I am no JavaScript expert but I think that onKeyPress is better for me
because it has already translated from virtual key to unicode. Also,
I believe if you hold down a key, you will get many onKeyPress events
for each
char that is processed but only one keyDown. I think you are right
though
that keyPress does not get called for all keys - I saw that it did not
get called on IE for a backspace (which makes sense since I assume
there is no
unicode defined for keys like a backspace.)
Thanks anyhow,
Fred Brown
Peter Hurford <pe***********@ microcrest.com> wrote in message
news:<3f******* *************** *@news.frii.net >...
I can't remember the exact details but I seem to recall having problems
trapping keys - esp. the tab key - with onkeypress.
My solution was to look at onkeydown instead.
I can think of lots of reasons why you'd want to do this, by the way.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!