使用javascript,当鼠标移过Table时,改变行的颜色

TD标签在没有给其设置颜色时是透明的,因此行的颜色由TR设置,注意:在OnMouseMove与OnMouseOut事件中设置颜色的js必须是this.style.background=...或者this.bgColor=...,注意javascript区分大小写

<table width="100%" cellpadding="0" cellspacing="0" border="0">
           <TR bgcolor=#ffffcc onmousemove='this.style.background="Silver"'
                OnMouseOut='this.style.background="#ffffcc"'>
            <td width="220" height="26" >
             &nbsp;<a href='MainList.aspx?BID=<%# DataBinder.Eval(Container.DataItem, "BigClass_ID") %>&SID=<%# DataBinder.Eval(Container, "DataItem.SmallClass_ID") %>'>
              <%# DataBinder.Eval(Container.DataItem, "SmallClass_Name") %>
             </a>
            </td>
            <td align="left" valign="middle" height="22" >
             <%# DataBinder.Eval(Container, "DataItem.Memo") %>
            </td>
            <td width="80" align="center" height="22">
             <%# DataBinder.Eval(Container, "DataItem.nosolved") %>
             /<%# DataBinder.Eval(Container, "DataItem.SUM") %>
            </td>
           </TR>
          </table>

你可能感兴趣的:(JavaScript)