zoukankan      html  css  js  c++  java
  • javascript控制数据窗口行的样式

         <style type="text/css">
       TD.bgstyle { BORDER-TOP: #215dc6 1px solid; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#C7D4F7, EndColorStr=#FFFFFF); COLOR: #215dc6; BORDER-BOTTOM: #215dc6 1px solid; BACKGROUND-COLOR: #e6e6e6 }
       TD.bgstyleleft { BORDER-TOP: #215dc6 1px solid; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#C7D4F7, EndColorStr=#FFFFFF); BORDER-LEFT: #215dc6 1px solid; COLOR: #215dc6; BORDER-BOTTOM: #215dc6 1px solid; BACKGROUND-COLOR: #e6e6e6 }
       TD.bgstyleright { BORDER-RIGHT: #215dc6 1px solid; BORDER-TOP: #215dc6 1px solid; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#C7D4F7, EndColorStr=#FFFFFF); COLOR: #215dc6; BORDER-BOTTOM: #215dc6 1px solid; BACKGROUND-COLOR: #e6e6e6 }
      </style>
      <script language="JavaScript">
      <!--
      function changein(object)
      {
       object.cells[0].className="bgstyleleft";
       count = object.cells.length;
       for(i = 1;i <= count-1;i++)
       {
        object.cells[i].className="bgstyle";
       }
       object.cells[count-1].className="bgstyleright";
       //document.all("Tblhisname").innertext="aaaa";
       //document.all.Tblhisname.value =object.cells[0].value;
      }
      //-->
      </script>
      <script language="JavaScript">
      <!--
      function changeout(object)
      {
       object.cells[0].className="";
       count = object.cells.length;
       for(i = 1;i <= count-1;i++)
       {
        object.cells[i].className="";
       }
       object.cells[count-1].className="";
      }
      //-->
      </script>


      private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
      {
       if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)

       {

        string OrderItemID =e.Item.Cells[0].Text;//e.item.cells[0].Text;
        Tblhisname.Text=OrderItemID;
        //添加自定义属性,当鼠标移过来时设置该行的背景色为"6699ff",并保存原背景色
        e.Item.Attributes.Add("onmouseover","currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");
        //添加自定义属性,当鼠标移走时还原该行的背景色
        e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=currentcolor");

        //MouseOver HighLighting
        e.Item.Attributes.Add("onmouseover","changein(this)");
        e.Item.Attributes.Add("onmouseout","changeout(this)");
        e.Item.Attributes.Add("onclick","window.open('Default.aspx?id=" + e.Item.Cells[0].Text + "');");

       }


    if( e.Item.ItemIndex != -1 )
    {
    e.Item.Attributes.Add("onmouseover", "this.bgColor='#C1D2EE'");
    e.Item.Attributes.Add("onclick", "document.all.text1.innerText=this.cells[0].innerText;document.all.form1.city.value=this.cells[0].innerText;");
    if (e.Item.ItemIndex % 2 == 0 )
    {
    e.Item.Attributes.Add("bgcolor", "#FFFFFF");
     e.Item.Attributes.Add("onmouseout", "this.bgColor=document.getElementById('DataGrid1').getAttribute('singleValue')");
    }
    else{
    e.Item.Attributes.Add("bgcolor", "oldlace");
     e.Item.Attributes.Add("onmouseout", "this.bgColor=document.getElementById('DataGrid1').getAttribute('oldValue')");
    }
    }else
    {
    DataGrid1.Attributes.Add("oldValue", "oldlace");
    DataGrid1.Attributes.Add("singleValue", "#FFFFFF");
    }
    }
    #region Web Form Designer generated codeoverride protected void OnInit(EventArgs e)
    {//// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。//InitializeComponent();base.OnInit(e);}

  • 相关阅读:
    Ajax缓存的几种处理方式
    Day--1--网络协议
    Day4--js--递归各种大法渡难关
    你以为的BUG--BFC给你解决!
    Day3--js--可恶之变量声明提升大法.。。
    Day2--js--烧脑睿智循环的练习题
    ERwin创建逻辑模型
    ERwin入门
    Oracle存储过程由例子到理论
    oracle存储过程
  • 原文地址:https://www.cnblogs.com/hhq80/p/657423.html
Copyright © 2011-2022 走看看