日期:2014-05-17 浏览次数:20670 次
<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>