首页 > 其他 > 详细

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

时间:2017-07-12 09:25:15      阅读:272      评论:0      收藏:0      [点我收藏+]

原文发布时间为: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 控件的行鼠标单击 以及 滑过特效

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!