Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<SELECT> Element Need to ScrollIntoView

Status
Not open for further replies.

fixthebug2003

Programmer
Oct 20, 2003
294
US
Hi,
I have <SELECT> Element with lots of (70+) OPTIONS in them.
I have set the height of the SELECT element to 250px..so it looks like a textarea with scrollbar.

I also have a simple text input box , just above the SELECT element where users can type in the first few words and then the SELECT element will select the option that matches the one in the text box, something similar to Search Index we get on HELP documents.

The only problem is that I could set the selectedIndex on the SELECT element to the one that matches in hte text box but the select item does not scroll to the top. If that can be accomplished it would be great.

Hope I explained clearly.

Fixthebug2003
 
Please show us the code that executes when text is typed into the textbox. Also, is this triggered from the onkeyup event?

--Dave
 
I experimented trying to use .scrollIntoView() on a select box with no luck. Instead of using a <SELECT> box, it might be easier to use a scrolling <DIV> with an inset border. Each option could be a checkbox or radio button.

Then you should be able to use something like:
document.getElementById("divOption4").scrollIntoView();

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top