根据value选中option
<select id="Animals">
<option value="0">Chicken</option>
<option value="1">Crocodile</option>
<option value="2">Monkey</option>
</select>
function SelectAnimal() {
var sel = document.getElementById('Animals');
var val = 1;
for(var i = 0, j = sel.options.length; i < j; ++i) {
if(sel.options[i].value== val) {
sel.selectedIndex = i;
break;
}
}
}
获取选中option的value
var e = document.getElementById("Animals");
var value = e.options[e.selectedIndex].value;
var text = e.options[e.selectedIndex].text;