这是IE的一个bug, 有几个workaround的方法你可以maintain几个array,然后每次都重建所有options或者用add/remove来动态添加/删除受影响的option:
function show_hide(id, text) {
var op = document.getElementById(id);
var select = document.getElementById("opt");
if (op) {
select.remove(op.index);
return;
}
for (var i=0; i id) break;
}
op = document.createElement('option');
op.text=text;
op.id = id;
try {
select.add(op, select.options[i]); // firefox
}
catch (ex) {
select.add(op, i); // ie
}
}
default
first option
second option
third option
fourth option
show/hide first option
show/hide second option
show/hide third option
show/hide fourth option
(more...)
阁下真乃神人也