GridView移动行变色

1.
        protected void myGridView_RowDataBound(object sender, GridViewRowEventArgs e)
        
{
            
//if (e.Row.RowType == DataControlRowType.Header)
            
//{
            
//    e.Row.Attributes.Add("style", "background-image:url('./HeadImages/headeImage.jpg')");
            
//}
            if (e.Row.RowType == DataControlRowType.DataRow)
            
{
                
//e.Row.Attributes["onmouseover"] = "ItemOver(this)";
                e.Row.Attributes.Add("onmouseover""e=this.style.backgroundColor; this.style.backgroundColor='#EEEEEE'");
                e.Row.Attributes.Add(
"onmouseout""this.style.backgroundColor=e");
            }

        }

2.
e.Row.Attributes["onmouseover"= "ItemOver(this)";
if (!objbeforeItem)
{
    
var objbeforeItem=null;
    
var objbeforeItembackgroundColor=null;
}
    
function ItemOver(obj)
{
    
if(objbeforeItem)
    
{
        objbeforeItem.style.backgroundColor 
= objbeforeItembackgroundColor;
    }

    objbeforeItembackgroundColor 
= obj.style.backgroundColor;
    objbeforeItem 
= obj;
    obj.style.backgroundColor 
= "#B9D1F3";     
}

posted on 2008-07-14 09:49  ★金★  阅读(313)  评论(0编辑  收藏  举报

导航