Welcome to WebmasterWorld Guest from 23.23.46.20

Forum Moderators: open

JavaScript question

detecting action keys in onKeyPress()

   
6:38 pm on Dec 31, 2002 (gmt 0)

10+ Year Member



I have an onKeyPress event hooked up to a textbox. I'm able to cature the letter of the normal display keys when they are pressed (I pull it from the event object), but I can't figure out how to detect whether an enter or backspace has occurred.

Any thoughts?

Ross

9:01 pm on Dec 31, 2002 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



As of Explorer 5 the onkeydown event fires for backspace, but not the onkeypress event. The Enter key is a flat out no-go for keypress event detection.

Not sure about Netscape/Moz/AOL etc. But IF you are going to get them to work, I'm betting you should use on keydown.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month