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
https://forums.phpfreaks.com/topic/23694-onkey-event-key-capture/
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.
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.