elcaro2k
01-14-2003, 12:50 PM
I have a listbox that is populated dynamically from an ADO recordset. I only show 10 rows at a time in the frame. I default to the first 10 and when say 41-50 is selected the page reloads in the frame and the correct rows are populated, however my list box reverts to 1-10. How can I default the listbox to the selection that was made?
By the way the listbox is in the page that gets reloaded.
Here is the code that builds the box.
var lowVal;
var highVal;
ct= <%=ct%>;
if (ct >= 10) {
var quotient= parseInt(ct) / 10;
var remainder= parseInt(ct) % 10;
for(var i=1;i<=quotient;i++){
lowVal = (i-1) * 10 + 1;
highVal = i * 10;
document.write("<option>" + lowVal + " - " + highVal);
}
if (remainder != 0){
lowVal= ((i-1) * 10) + 1;
highVal= ((i-1) * 10) + remainder;
document.write("<option>" + lowVal + " - " + highVal);
}
iniVal=document.getElementById("criSel").options[0].text;
iniLowVal=iniVal.substring(0,iniVal.indexOf("-"));
iniHighVal=iniVal.substring(iniVal.indexOf("-")+1,iniVal.length);
}else if(ct < 10) {
document.getElementById("criSel").style.display="none";
document.getElementById("SelCriLbl").style.display="none";
}
By the way the listbox is in the page that gets reloaded.
Here is the code that builds the box.
var lowVal;
var highVal;
ct= <%=ct%>;
if (ct >= 10) {
var quotient= parseInt(ct) / 10;
var remainder= parseInt(ct) % 10;
for(var i=1;i<=quotient;i++){
lowVal = (i-1) * 10 + 1;
highVal = i * 10;
document.write("<option>" + lowVal + " - " + highVal);
}
if (remainder != 0){
lowVal= ((i-1) * 10) + 1;
highVal= ((i-1) * 10) + remainder;
document.write("<option>" + lowVal + " - " + highVal);
}
iniVal=document.getElementById("criSel").options[0].text;
iniLowVal=iniVal.substring(0,iniVal.indexOf("-"));
iniHighVal=iniVal.substring(iniVal.indexOf("-")+1,iniVal.length);
}else if(ct < 10) {
document.getElementById("criSel").style.display="none";
document.getElementById("SelCriLbl").style.display="none";
}