There are a couple of methods, one is to create an array of the option values (or text, whatever you want to sort on) and create an object with properties whose names are the option values (or text) and values are references to the options.
Sort the array, then iterate over it, using the member values to get the options from the object, e.g.
function sortOptionsByValue(select) {
var a = [], o = {}, opt;
for (var i=0, iLen=select.options.length; i<iLen; i++) {
opt = select.options[i];
a.push(opt.value);
o[opt.value] = opt;
}
a.sort();
while (i--) {
select.insertBefore(o[a[i]], select.firstChild);
}
// Optional, make first option selected
select.selectedIndex = 0;
}
There are other methods, the above is just one. But it will work in any ECMA-262 compliant browser and doesn't depend on host objects acting like native objects, only that they behave like the W3C DOM Core says they should.