Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

selectedIndex focus

Hiyas,
Is there a way to scroll to  the selectedIndex of a select list if it's not being shown in the visible rows? I'm using size="4" on the <select> and the option list is much longer than that.

I'm building the list and setting a 'selected' option with ASP.  That's all fine.  The correct option is showing up highlighted...it's just not immediately visible sometimes.

This has to work in Netscape too by the way.
0
WrrX
Asked:
WrrX
  • 2
1 Solution
 
Michel PlungjanIT ExpertCommented:
Not possible in netscape - known bug.

In IE the
document.myForm.mySelect.selectedIndex = 10;
should scroll to the 10th entry

Michel
0
 
FaxeCommented:
Since you're working with asp, why don't you try working around it by changing the sort order of the multiple select box.
the items marked that are selected are places at the top of the list instead of at their regular position (like alphabetical)...

<OPTION SELECTED>3</OPTION>
<OPTION SELECTED>6</OPTION>
<OPTION SELECTED>9/OPTION>
<OPTION> </OPTION>
<OPTION>1</OPTION>
<OPTION>2</OPTION>
<OPTION>4</OPTION>
<OPTION>5</OPTION>
<OPTION>7</OPTION>
<OPTION>8</OPTION>
0
 
Michel PlungjanIT ExpertCommented:
Hmm - and use javascript to rewrite the order of the select on later changes... If the user won't be confused about the order - why not...

Michel
0
 
WrrXAuthor Commented:
Sometimes the most obvious things escape me :)  Thanks for the extra info too Michel.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now