日期:2014-05-19  浏览次数:20359 次

《这样改变背景色》td已经应用了样式
<tr   onmouseover= "changebg() ">
                                                        <td   style= "width:   7%; "> 8 </td>
                                                        <td   style= "width:   44% "> <a   href= "# "   style= "text-decoration:underline;   color:#00f; "> 王小二 </a> <span   style= "color:#808080; "> (2007-5-14) </span> </td>
                                                        <td   style= "width:   20% "> 李大山 </td>
                                                        <td   style= "width:   20% "> 13102020202 </td>
                                                        <td   style= "width:   9% "> <img   src= "images/ing.gif "   /> </td>
                                                </tr>

---------------
<script   type= "text/javascript "   src= "js/changebgcolor.js ">       function   changebg()
{
        var   n=this.getElementsByTagName( 'td ').length;
      //   for(var   i=0;   i <n;   i++)
          //       {
        //                 this.getElementsByTagName( 'td ')[i]= "#f00 "
        //         }
}
</script>
---------------

------解决方案--------------------

------解决方案--------------------
呵呵 学习
------解决方案--------------------
this.getElementsByTagName( 'td ')[i].style.backgroundColor= "#f00 "