H
headware
I have a <select> control that contains many entries. It allows the
user to multi-select a group of them, click a button, and store the
selected data in a database. Normally they do this starting at the top
of the list moving down towards the bottom. The problem I was having
was that the <select> control was scrolling back to the top of the
page after the postback and the user would lose their place in the
<select> control forcing them to scroll through it by hand to find the
items they just selected. Adding the following javascript helped:
function scrollToSelection()
{
var myList = document.forms[0].selectCtrl;
if(myList.selectedIndex >= 0)
{
myList.options[myList.selectedIndex].selected = true;
}
}
This works pretty well except that the <select> control stops
scrolling once the first selected item is showing at the bottom of the
list. This forces the user to scroll by hand in order to get to the
items after the selected ones, which is inconvinient. Is there a fix
for this? Can I make the <select> control scroll down so a few items
after the last selected item are showing at the bottom?
Thanks,
Dave
user to multi-select a group of them, click a button, and store the
selected data in a database. Normally they do this starting at the top
of the list moving down towards the bottom. The problem I was having
was that the <select> control was scrolling back to the top of the
page after the postback and the user would lose their place in the
<select> control forcing them to scroll through it by hand to find the
items they just selected. Adding the following javascript helped:
function scrollToSelection()
{
var myList = document.forms[0].selectCtrl;
if(myList.selectedIndex >= 0)
{
myList.options[myList.selectedIndex].selected = true;
}
}
This works pretty well except that the <select> control stops
scrolling once the first selected item is showing at the bottom of the
list. This forces the user to scroll by hand in order to get to the
items after the selected ones, which is inconvinient. Is there a fix
for this? Can I make the <select> control scroll down so a few items
after the last selected item are showing at the bottom?
Thanks,
Dave