File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes simulate shift key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "simulate shift key" Watch "simulate shift key" New topic

simulate shift key

seb petterson
Ranch Hand

Joined: Mar 04, 2005
Posts: 118
I am trying to implement navigation with arrowkeys in a "grid". The grid is a table containing input fields. The vertical navigation with up and down arrows I got working through giving the input fields id values that increment downwards like this:
0 3 6
1 4 7
2 5 8
Plus with a bit of javascripting.
Now I need to be able to navigate horisontally.
the problem is that the table is generated dynamically so I can't know how many rows or how many columns there are. And I also dont know if the number of cells in each row might different from the number of input fields.
So: my idea was to emulate tabbing! It works fine with the right arrow, when its pressed i execute:

And the browser behaves as if the TAB key was pressed
The problem I have is with the left key, which would be SHIFT+TAB. How do I emulate that??

I allreayd tried:

But id didnt work

[ April 11, 2006: Message edited by: seb petterson ]
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Just to let you know IE is the only browser that lets you set the keycode so you are not going to be able to use this in any other browser.

I agree. Here's the link:
subject: simulate shift key
It's not a secret anymore!