zoukankan      html  css  js  c++  java
  • 行改变色

     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>

  • 相关阅读:
    prototype常用函数
    SQL Left Join,用于在网站中显示相关联的内容
    .net中ajax实现检测用户名的完整测子
    绑定数据源后,Repeater在创建时触发的事件,以及如果在cs文件中调用某个字段的值
    sql2005 转换到 sql2000
    FCKeditor 2.6.3在ASP.NET中的配置方法
    怎样和老板谈绩效考核(3)
    If Tomorrow Never Comes
    为何会被拒(1)
    为何会被拒(2)
  • 原文地址:https://www.cnblogs.com/IsNull/p/1718265.html
Copyright © 2011-2022 走看看