Goose Posted October 11, 2006 Share Posted October 11, 2006 I am using a couple different onkey... event listeners in Javascript, i.e. onkeyup. When I hit some of these event listeners I want to know which key was actually hit. Here is my code now:[code]<input type="text" ... onkeyup="move_to_next(3, this, 'next_item_id');" />[/code]The move_to_next() function checks the [i]this[/i] element and if the length equals the first argument then it puts the focus on the element with the id of the last argument. What I really want to do now is conditionally move the focus depending on which keys are hit.[b]Is there a way for me to pass which key was hit to my move_to_next() function?[/b]Thanks in advance. Quote Link to comment Share on other sites More sharing options...
obsidian Posted October 11, 2006 Share Posted October 11, 2006 check out [url=http://www.breakingpar.com/bkp/home.nsf/0/CACEB633F995E9CE87256AFB00141646]this article[/url] on capturing keystrokes. if you couple this with what you're already doing, i'm sure you can come up with a workable solution ;) Quote Link to comment Share on other sites More sharing options...
Goose Posted October 11, 2006 Author Share Posted October 11, 2006 So far I haven't had any luck implementing this. If you can show me a working example that would be awesome. This site sort of explains the idea, but it would be really helpful, for me, to see how it is implemented.Thanks. I am going to continue trying to make this work. Quote Link to comment Share on other sites More sharing options...
Goose Posted October 11, 2006 Author Share Posted October 11, 2006 I guess I was searching for the wrong terms in google before I posted here because I wasn't getting good hits, but this time around I was much more successful. Basically this site has some semi-working functions that I think I can clean up and make work:http://www.mark-itt.ru/docs/dynamic_duo/keystrokes/keystrokes.html Quote Link to comment Share on other sites More sharing options...
fenway Posted October 11, 2006 Share Posted October 11, 2006 IE has an global event object that has keyCode... no idea about FF. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.