阿宽

Nothing is more powerful than habit!
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Asp.net 高亮显示鼠标所在行

Posted on 2008-09-26 17:09  宽田  阅读(311)  评论(0编辑  收藏  举报

调用的JavaScript:

    <script type="text/javascript">
    
/*高亮显示鼠标所在行*/
    
function mouseovertd2(o)
    {
    dff
=o.style.backgroundColor;
    o.style.backgroundColor
="#EAEBF1";
    }
    
function mouseouttd2(o)
    {
     o.style.backgroundColor
=dff;
    }
    
</script>

 

 

 GridView中的DataBound事件代码:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {        
        
if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add(
"onmouseover""mouseovertd2(this)");
            e.Row.Attributes.Add(
"onmouseout""mouseouttd2(this)");
            e.Row.Attributes[
"style"= "Cursor:hand";
        }
    }