.net鼠标经过时变色

来源:互联网 发布:数据集成平台方案 编辑:程序博客网 时间:2024/05/20 21:18

 js  代码

 

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

 

后台代码

 

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