hi ...
have a look at the insertBefore() dom-method here
kind regards
^^ exactly
Never use functions / methods that are not browser (standards) compatible. That will just result into unnecessary page restrictions. All reasonable browsers supports dom so:
[PHP]var newOption = document.createElement('option');
newOption.value = my_value;
newOption.appendChild(document.createTextNode('my_ text'));
// if you want to insert in the end
obj.appendChild(newOption);
// if you want to insert not in the end (on index position)
obj.insertBefore(newOption, obj.options[index]);
[/PHP]
(where obj is selectbox element)
gonna work widely.
Well there is one exception (but it's just a bug) that it's very rare. But in Opera when your selectbox is inside the hidden div and you want to alter it while it's hidden, "sometimes" opera acts strange. I wont describe it now, but remember: if you will have strange behavior in opera:
1) just disconnect selectbox from DOM tree (keep it in local variable for example)
2) make changes you need
3) attach it back on the same place to DOM tree