• 行改变色


     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    string key = this.GridView1.DataKeys[e.Row.RowIndex].Value.ToString();
                    e.Row.Attributes.Add("onmouseover", "if(this!=prevselitem){this.style.backgroundColor='#Efefef'};this.style.cursor='hand';");//当鼠标停留时更改背景色
                    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);setvalue('" + key + " ')");
                    // e.Row.Attributes.Add("onclick", "alert('"  + key + " ')");
                   
                }
            }

     <script type="text/javascript">
          var prevselitem=null;
           function selectx(row)
          {
                  if(prevselitem!=null)
                 {
                      prevselitem.style.backgroundColor='#ffffff';
                   }
                  row.style.backgroundColor='PeachPuff';
                  prevselitem=row;
                 
          }
          function setvalue(obj)
          {
          document.getElementById("Hidden1").value=obj;
          document.getElementById("dd").innerHTML=obj;
          alert(obj);
           document.all('Button1').click();
     
          }
      </script>

  • 相关阅读:
    Protocol Buffers教程
    Paxos、ZAB、RAFT协议
    kafka自定义序列化器
    Java cas原理
    常见的排序算法
    Java反射
    etcd单机集群
    通过tomcat shutdown port关闭tomcat
    Java ConcurrentHashMap初始化
    LaTeX技巧892: Ubuntu 安装新版本TeXLive并更新
  • 原文地址:https://www.cnblogs.com/IsNull/p/1718265.html
Copyright © 2020-2023  润新知