homepage Welcome to WebmasterWorld Guest from 54.163.139.36
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
JavaScript question
detecting action keys in onKeyPress()
RossWal

10+ Year Member



 
Msg#: 251 posted 6:38 pm on Dec 31, 2002 (gmt 0)

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

 

tedster

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



 
Msg#: 251 posted 9:01 pm on Dec 31, 2002 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved