在.aspx中代码如下:        <ItemTemplate>
            <table class="hsdContent" style="width:100%;" >
                <tr class="OldLine" onmouseover="style.background-color:'#C86F70'">
                    <td style="width:10%;"><%#Eval("HSDID") %></td>
                    <td style="width:60%;text-align:left;"><%#Eval("Title") %></td>
                    <td style="width:10%;"><%#Eval("Status") %></td>
                    <td style="width:10%;"><asp:ImageButton ID="Index_Reproduce" runat="server" ImageUrl="image/ReproduceButton.jpg" OnClick="Reproduce_Click"/></td>
                    <td style="width:10%;"><asp:ImageButton ID="Index_Submit" runat="server" ImageUrl="image/SubmitButton.jpg" CommandName="Edit" CommandArgument='<%#Eval("id")+","+Eval("HSDID")%>' OnClick="Edit_Click" /></td>                    
                </tr>
            </table>
        </ItemTemplate> 我想要是的当出表移动到该行时,改变这行的背景色。写法如上为什么不可行呢?请帮帮忙 谢谢!
我用响应事件做 试了下,在.aspx.cs中不响应对应函数。

解决方案 »

  1.   

    额···这个有对应函数吗???这个不是应该用JS来实现吗?onmouseover调用一个JS函数
      

  2.   

    like these:
    http://www.cnblogs.com/insus/archive/2011/06/25/2090071.htmlhttp://www.cnblogs.com/insus/p/3214497.htmlhttp://www.cnblogs.com/insus/archive/2012/10/29/2744769.html
      

  3.   


    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
       <script type="text/javascript">
           $(function () {
               $("table tr").mouseleave(function () {
                   $(this).css("background-color", "yellow");
               });
           })
       </script>
    </head>
    <body>
        <table border="1">
            <tr>
                <td style="width:100px"> 1 </td>
                <td style="width:100px"> 2 </td>
                <td style="width:100px"> 3 </td>
                <td style="width:100px"> 4 </td>
            </tr>
                    <tr>
                <td style="width:100px"> 1 </td>
                <td style="width:100px"> 2 </td>
                <td style="width:100px"> 3 </td>
                <td style="width:100px"> 4 </td>
            </tr>                <tr>
                <td style="width:100px"> 1 </td>
                <td style="width:100px"> 2 </td>
                <td style="width:100px"> 3 </td>
                <td style="width:100px"> 4 </td>
            </tr>
        </table>
    </body>
    </html>
    这样??
      

  4.   

    onmouseover="javascript:style.backgroundColor='#C86F70'"
      

  5.   


    onmouseover="this.style.backgroundColor='#C86F70'"
    这样就可以了