GridView鼠标效果001

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

    }
http://blog.csdn.net/wkjs/archive/2006/12/06/1432560.aspx


GridView鼠标移动变色 http://blog.csdn.net/hz/archive/2006/01/08/573371.aspx

在GridView的

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onMouseOver", "SetNewColor(this);");
            e.Row.Attributes.Add("onMouseOut", "SetOldColor(this);");
        }
    }

在页面中加入

<script language="javascript">
       var _oldColor;
       function SetNewColor(source)
       {
          _oldColor=source.style.backgroundColor;
          source.style.backgroundColor='#666666';
         
       }
       function SetOldColor(source)
       {
         source.style.backgroundColor=_oldColor;
       }
    </script>


 DataGrid行随鼠标变色 http://blog.csdn.net/chuqunpeng/archive/2006/04/30/698747.aspx

private void DGzf_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
 if (e.Item.ItemType!=ListItemType.Header)
 {
  e.Item.Attributes.Add( "onmouseout","this.style.backgroundColor=\""+e.Item.Style["BACKGROUND-COLOR"]+"\"");
  e.Item.Attributes.Add( "onmouseover","this.style.backgroundColor=\""+ "#EFF3F7"+"\"");
 }
}
posted @ 2006-12-06 23:46  Kevin Lin  阅读(333)  评论(0编辑  收藏  举报