DropDownList 下拉列表项变色
DropDownList 如何在下拉列表中根据字段的数值不同.使下拉列表中的项显示的颜色不同.比如一显示绿色.
[解决办法]
<select id="osel"><option value='1'>red</option><option value='2'>blue</option><option value='3'>yellow</option></select><SCRIPT LANGUAGE="JavaScript"><!-- document.getElementById("osel").options[0].style.backgroundColor='red'; document.getElementById("osel").options[1].style.backgroundColor='blue'; document.getElementById("osel").options[2].style.backgroundColor='yellow';//--></SCRIPT>
[解决办法]
<select id="osel"><option value='1' style="background-color:red">red</option><option value='2' style="background-color:blue">blue</option><option value='3' style="background-color:yellow">yellow</option></select>