This isn't a full answer,

First, I don't know of any re-usable code. I coded something very
similar for my company, of an Excel like grid that used arrow keys and
selection techniques using the keyboard. My bigger challenge was cross
browser compatibility. IE allows you to give focus to any HTML
element, but Firefox, only form elements. So, to fix this, I created a
hidden input element (I think I used a <input type="text"
style="visibility: hidden; ..." />). In that hidden element, I capture
key events and move the input box using CSS absolute positioning and
re-focus on the element.

In your example, you could move the control around, putting it in each
table row and using the javascript scroll commands (I remember those
being different on IE and firefox too).

On 6/28/07, Caroline Jen <[EMAIL PROTECTED]> wrote:
My web pages are coded in JSF.  My question is
JavaScript related.  I know maybe it is a wrong forum
to post this question but I simply want to take a
chance.

I put a h:datatable inside the <div ....> tag. And I
have created a scrollbar for the <div ...> tag.

The height of the <div ...> is set to display a
certain number of rows of the data table for viewing.
Let's say that I can see 10 rows within the <div
....>.

The challenge is that I must also use the up/down
arrow keys on the keyboard to view all the rows in
that table. The requirements are:

1. The first row of the table must be highlighted when
the web page is brought up to the screen.

2. Pressing the down arrow key once moves the
highlighter to the second row of the table; so on so
forth.

3. When the highlighter is on the 10th row of the
table, pressing the down arrow key will bring the 11th
to 20th rows of the table for viewing and the
highlighter will be on the 11th row of the table.

4. It keeps going util the last set of rows (maybe
less than 10) are brought up to the screen.

5. The up arrow key works in a similar way.

I have surfed on the internet and found

http://www.tipstrs.com/tip/799/Scrol...g-the-keyboard
http://www.codeproject.com/jscript/W...lScrollbar.asp

I think that the JavaScript function
"scrollIntoView()" is very promising.

Does a re-usable code exist?



____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for 
today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow

Reply via email to