File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes onkeydown before onchange event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "onkeydown before onchange event" Watch "onkeydown before onchange event" New topic
Author

onkeydown before onchange event

Luke Zechariah
Ranch Hand

Joined: Sep 27, 2005
Posts: 124
I have onkeydown event and a onchange event for a drop down list. The problem is that if a user has to type "jww", the moment they type "j" the onchange event is triggered. Is there way the onchange event can be delayed till the onkeydown event is completely finished.

Thank you for your reply in advance.
Luke
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15385
    
    6
Only choice you will have is use onblur or add a setTimeout to the onchange delay the firing and use cancelTimeout.

Eric
Luke Zechariah
Ranch Hand

Joined: Sep 27, 2005
Posts: 124
Eric, thanks that was a very quick reply. Here is my code, I am not good at javascript can you let me know what to add please:



Thank you,
Lk.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15385
    
    6
look at this:
http://www.manning-sandbox.com/thread.jspa?threadID=14781&tstart=0

You may want to cancel the timeout with the onkeypress

Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: onkeydown before onchange event
 
It's not a secret anymore!