jQuery改变GridView的样式

 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        
if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add(
"onmouseover""c=this.style.backgroundColor;this.style.backgroundColor='#B9D3EE'");
            e.Row.Attributes.Add(
"onmouseout""this.style.backgroundColor=c");
        }
    }

 也可以利用JQUERY实现相关的功能

            //变色
            $("tr").filter(function(){
                
return $('td',this).length && !$('table',this).length
             }).css({ background:
"ffffff" }).hover(
                    
function(){$(this).css({background:"#C1DAD7"});},
                    
function(){$(this).css({background:"#ffffff"});}
             );

 实例代码

 

posted @ 2010-03-19 14:21  smodi  阅读(475)  评论(0编辑  收藏  举报