/* Code to Sort Option List */
var lb = document.getElementById("fslr_custompicklist");
arrTexts = new Array();
arrValues = new Array();
arrID = new Array();
var len = lb.length;
for (i = 0; i < len; i++) {
arrTexts[i] = lb.options[i].text;
arrValues[i] = lb.options[i].value;
arrID[i] = lb.options[i].text;
}
arrID.sort();
for (i = 0; i < lb.length; i++) {
lb.options[i].text = arrID[i];
for (j = 0; j < arrValues.length; j++) {
if (arrTexts[j] == arrID[i]) {
lb.options[i].value = arrValues[j];
break;
}
}
}
}
No comments:
Post a Comment