Solved

selectedIndex focus

Posted on 2000-04-18
4
221 Views
Last Modified: 2008-01-09
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
Comment
Question by:WrrX
  • 2
4 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2725856
Not possible in netscape - known bug.

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

Michel
0
 
LVL 1

Accepted Solution

by:
Faxe earned 75 total points
ID: 2726591
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
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2727055
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
 

Author Comment

by:WrrX
ID: 2728804
Sometimes the most obvious things escape me :)  Thanks for the extra info too Michel.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question