zoukankan      html  css  js  c++  java
  • gridview 选中行变色

    1,在aspx中加

    <script type="text/javascript">
        var prevselitem=null;
        function selectx(row)
        {
            if(prevselitem!=null)
            {
                prevselitem.style.backgroundColor='#ffffff';
            }
            row.style.backgroundColor='PeachPuff';
            prevselitem=row;   
        }
    </script>

    2,在RowDataBound事件中加

    if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onmouseover", "if(this!=prevselitem){this.style.backgroundColor='#Efefef'}");//
    当鼠标停留时更改背景色 
            e.Row.Attributes.Add("onmouseout", "if(this!=prevselitem){this.style.backgroundColor='#ffffff'}");//
    当鼠标移开时还原背景色 
            e.Row.Attributes.Add("onclick", e.Row.ClientID.ToString() + ".checked=true;selectx(this)");
        }
  • 相关阅读:
    grafana邮箱配置
    grafana集群配置
    CentOS7 配置OOM监控报警
    Mycat使用配置实践
    CentOS7安装JAVA环境
    CentOS7安装MYCAT中间件
    CentOS7安装MySQL5.6
    Mockingbird
    堆的建立与功能实现
    Matlab解决线性规划问题
  • 原文地址:https://www.cnblogs.com/diony/p/1911364.html
Copyright © 2011-2022 走看看