var allSelect = document.getElementsByTagName("select");
for (var i=0; i<allSelect.length; i++)
{
    if (allSelect[i].style.backgroundColor.toUpperCase() == "#C0C0C0")
    {
        allSelect[i].disabled = true;
    }
}没测,试试看!

解决方案 »

  1.   

    呵呵,我看了下select的backgroundColor,发现不起作用啊
      

  2.   

    var a=document.getElementsByTagName("SELECT")
        for (var i=0; i<a.length; i++)
        a[i].disabled=a[i].style.backgroundColor.toUpperCase()=="#C0C0C0"?true:false;
      

  3.   

    呵呵,我看了下select的backgroundColor,发现不起作用啊
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    用background
      

  4.   

    如果不行就用currentStyle["background-color"]
      

  5.   

    应该是background-color,但是我用for(c in selectID)居然看不到这个属性……
      

  6.   

    js遍历应该是backgroundColor这个吧
    html的就是background-Color
      

  7.   

    <select name="" id="sel" style="background-color:red">
      <option>a</option>
      <option>b</option>
      <option>c</option>
    </select>
    <script type="text/javascript">
    //<![CDATA[
        alert(sel.currentStyle['backgroundColor'])
        for (var i in sel.currentStyle)
        document.write(i+":"+sel.currentStyle[i]+"<br/>")
    //]]>
    </script>