改变DataGird行样式

<table border="0" cellpadding="0" cellspacing="0" width="100%">
 <tr>
  <td height="15"></td>
 </tr>
 <tr>
  <td>
   <asp:DataGrid id="dtGridTeamUser" runat="server" AutoGenerateColumns="False" Width="100%" CssClass="small"></asp:DataGrid>
  </td>
 </tr>
</table>


<style type=text/css>
.small{ font-size: 9pt; weaver:expression(highlight(this))}
</style>

<script language="javascript">
        function highlight(obj)
        {
            var hightlightBgColor = '#d6d6d6';
            obj.onmouseover = function()
            {
                var o = event.srcElement;

                if(o.tagName=="TD")
                {
                    with(o.parentElement)
                    {
                        style.backgroundColor = hightlightBgColor;
                    }
                }
            }
   
            obj.onmouseout = function()
            {
                var o = event.srcElement;
                if(o.tagName=="TD"){o.parentElement.style.backgroundColor = '';}
            }
        }
         </script>

你可能感兴趣的:(Data)