zoukankan      html  css  js  c++  java
  • 【原创】datalist repeater 控件的行鼠标单击 以及 滑过特效

    原文发布时间为: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";
           }
    }

  • 相关阅读:
    PSP第二次总结
    周总结02
    四则运算2
    构建执法阅读笔记01
    周学习进度01
    暑假生活一
    构建之法阅读笔记03
    构建之法阅读笔记02
    个人课程总结
    软工大二下半年第十六周学习进度
  • 原文地址:https://www.cnblogs.com/handboy/p/7153281.html
Copyright © 2011-2022 走看看