道。道。道

安全特性不等于安全的特性

   :: 首页 :: 联系 :: 聚合  :: 管理

常用链接

搜索

  •  

最新评论

  1. 方法一:   
  2.   
  3. 在GridView的   
  4.   
  5. protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)   
  6.     {   
  7.         if (e.Row.RowType == DataControlRowType.DataRow)   
  8.         {   
  9.             e.Row.Attributes.Add("onMouseOver""SetNewColor(this);");   
  10.             e.Row.Attributes.Add("onMouseOut""SetOldColor(this);");   
  11.         }   
  12.     }   
  13.   
  14. 在页面中加入   
  15.   
  16. <SCRIPT language=javascript>   
  17.        var _oldColor;   
  18.        function SetNewColor(source)   
  19.        {   
  20.           _oldColor=source.style.backgroundColor;   
  21.           source.style.backgroundColor='#666666';   
  22.              
  23.        }   
  24.        function SetOldColor(source)   
  25.        {   
  26.          source.style.backgroundColor=_oldColor;   
  27.        }   
  28.     </SCRIPT>   
  29.   
  30.     
  31.   
  32. 方法二:   
  33.   
  34.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)   
  35.     {   
  36.         if (e.Row.RowType == DataControlRowType.DataRow)   
  37.         {   
  38.             e.Row.Attributes["onMouseOver"] = "js.ItemOver(this)";   
  39.         }   
  40.     }   
  41.   
  42. 在页面上加入   
  43.   
  44. <SCRIPT language=javascript type=text/javascript>   
  45.     var js=new function(){   
  46.     if (!objbeforeItem){var objbeforeItem=null;var objbeforeItembackgroundColor=null;}   
  47.         this.ItemOver=function(obj)   
  48.     {   
  49.         if(objbeforeItem){objbeforeItem.style.backgroundColor = objbeforeItembackgroundColor;}   
  50.         objbeforeItembackgroundColor = obj.style.backgroundColor;   
  51.         objbeforeItem = obj;   
  52.         obj.style.backgroundColor = "#fcfcfc";        
  53.     }   
  54.   
  55. }   
  56.     </SCRIPT>   
  57.   
  58. 方法三:   
  59.   
  60.  protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)   
  61.     {   
  62.         if (e.Row.RowType == DataControlRowType.DataRow)   
  63.         {   
  64.          //鼠标移动到每项时颜色交替效果   
  65.          e.Row.Attributes.Add("OnMouseOut""this.style.backgroundColor='White';this.style.color='#003399'");   
  66.          e.Row.Attributes.Add("OnMouseOver""this.style.backgroundColor='#6699FF';this.style.color='#8C4510'");   
  67.   
  68.         //设置悬浮鼠标指针形状为"小手"   
  69.          e.Row.Attributes["style"] = "Cursor:hand";   
  70.         }   
  71.     }  
posted on 2007-11-20 21:36 独孤九剑 阅读(384) 评论(0)  编辑 收藏 引用 所属分类: Learn articles