Jump to content

onkey... event key capture


Goose

Recommended Posts

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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.