我有这个多选项我想要更改个人选项的默认背景. select size="8" name="lstSelectedPackages" style="width:100%" option value="" selected="selected"Select/option/select 小提琴:http://jsfiddle.net/ux4DD/180/ 谢谢! 如果
<select size="8" name="lstSelectedPackages" style="width:100%"> <option value="" selected="selected">Select</option> </select>
小提琴:http://jsfiddle.net/ux4DD/180/
谢谢!
如果jQuery最适合你,那么我相信这会非常有帮助.<script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> $(function() { $("select option:selected").each(function () { $(this).css('background-color','red'); }); }); </script> <select name="garden"> <option>Flowers</option> <option selected="selected">Shrubs</option> <option>Trees</option> <option>Bushes</option> <option>Grass</option> <option>Dirt</option> </select> <div></div>