document.getElementById('yt').style.backgroundColor ='#FF0000';

解决方案 »

  1.   

    修改1.
    function fu(){
    document.getElementById('yt').style.background  ='#FF0000';
    }
    修改2.增加一個div<td height="20"  ><div id="yt">&nbsp;</div></td>
        <td bgcolor="#FF0000">&nbsp;</td>
      

  2.   

    document.getElementById('yt').style.background  ='#FF0000';
      

  3.   

    要用style.background 而不是bgcolor
      

  4.   

    <table><tr><td id='fff'>fffffff</td></tr></table>
    <script>
    document.all("fff").bgColor = "red"
    document.all("fff").style.backgroundColor  = "blue"
    </script>两种方法都可以
      

  5.   

    UP楼上的~
    bgColor是一属性,不在style下面的~
    background-color才是style下面的属性~但在脚本下面,要写成backgroundColor