Need JavaScript help with Listbox
I have a dropdown listbox called "list1".
It is a single select listbox.
It is a required field on the page.
It contains a list of items sorted in alphabetical order.
This list is loaded from a database table.
This list is updated daily.
This list will always contain a min of 80 and max of 120 items.
The users do not like to scroll thru so many items to find the 1 item they need.
The main reasons are that the vertical scrolling is a pain and
there are many other fields on the screen so speed is important.
To find the items that begin with "B" they have to click on the listbox
and then click on the "B" key. This scrolls down to the first item
beginning with "B". But this involved the mouse and keyboard.
And mouse again if they want to scroll further into the list of B's.
To speed this up we want to eliminate the keyboard.
Here is how:
1. Keep the listbox as is.
2. Put a row of radio buttons above the listbox.
3. The radio buttons are labeled "A", "B", ... "Z"
4. When the user clicks on the "B" radio button, the
JavaScript automatically scrolls the listbox to
the first item beginning with "B".
5. Then the user can do more scrolling if needed.
I am not a JavaScript expert.
Can you help me with a JavaScript that:
a. I can add to the onclick of the radiobuttons.
b. It grabs the label of the selected radiobutton.
c. Scrolls vertically to the first occurence of
the matching item in the listbox.
Thanks.
|