码迷,mamicode.com
首页 > 其他好文 > 详细

【原创】datalist repeater 控件的行鼠标单击 以及 滑过特效

时间:2017-07-12 10:20:15      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:new   function   dex   java   ext   单击   obj   http   百度   

原文发布时间为:2009-05-06 —— 来源于本人的百度文章 [由搬家工具导入]

调用方法如:<tr id="<%# Container.ItemIndex+1 %>" onclick="LightRow(this)" onmouseover=" MouseOverColor(this)" onmouseout="MouseOutColor(this)"
objTr.bgColor,objTr.style.backgroundColor 这两种写法自己选着用

单击背景色改变,再次单击背景色还原
<script type="text/javascript">
var oldid="";
function LightRow(objTr)
{
   var newid=objTr.id;
   if(objTr.bgColor!="#ffe7a7") //进制式颜色不能用大写,要用小写
   {
      objTr.bgColor="#ffe7a7";
      if(oldid!=""&&oldid!=newid)
        document.getElementById(oldid).bgColor="";
      oldid=newid;
    }
    else
    {
       document.getElementById(oldid).bgColor="";//作者:http://hi.baidu.com/handboy
     }
}

function MouseOverColor(objTr)
{
   if(objTr.bgColor!="#ffe7a7")
   {
      objTr.bgColor="AliceBlue";
   }
}
function MouseOutColor(objTr)
{
   if(objTr.bgColor!="#ffe7a7")
   {
      objTr.bgColor="";
   }
}
</script>


单击背景色改变,再次单击背景色不改变
<script type="text/javascript">
    var oldid="";
    function LightRow(objTr)
    {
       var newid=objTr.id;
       if(objTr.style.backgroundColor!="#ffe7a7")
       {
          objTr.style.backgroundColor="#ffe7a7";
          if(oldid!=""&&oldid!=newid)
            (document.getElementById(oldid)).style.backgroundColor="White";
          oldid=newid;
        }
    }

    function MouseOverColor(objTr)
    {
       if(objTr.style.backgroundColor!="#ffe7a7")
       {
         objTr.style.backgroundColor="AliceBlue";
       }
    }
    function MouseOutColor(objTr)
    {
       if(objTr.style.backgroundColor!="#ffe7a7")
       {
          objTr.style.backgroundColor="White";
       }
}

【原创】datalist repeater 控件的行鼠标单击 以及 滑过特效

标签:new   function   dex   java   ext   单击   obj   http   百度   

原文地址:http://www.cnblogs.com/handboy/p/7153281.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!