• JS 隔行变色


     <script type="text/javascript">  
        window.onload=function(){     
           var oUl=document.getElementById('ul1');     
           var aLi=oUl.getElementsByTagName('li');      
           for(var i=0; i< aLi .length; i++)  {       
               if(i%2==0)  //取模 求余数          
            {   
                aLi[i].style.background='red';  
              
            }    
            }  
        }  
        </script>  
        <ul id="ul1">  
          <li>webtall</li>  
          <li>webtall</li>  
          <li>webtall</li>  
          <li>webtall</li>  
          <li>webtall</li>  

        </ul>









    <head runat="server">
        <title></title>
        <script type="text/javascript">
            window.onload = function () {
                var otab = document.getElementById('tab1');
                var thiscolor = '';
                for (var i = 0; i < otab.tBodies[0].rows.length; i++) {
                    otab.tBodies[0].rows[i].onmouseover = function () {
                        thiscolor = this.style.background;
                        this.style.background = '#00FFFF';
                    };
                    otab.tBodies[0].rows[i].onmouseout = function () {
                        this.style.background = thiscolor;
                    };
                    if (i % 2) {
                        otab.tBodies[0].rows[i].style.background = '';
                    }
                    else {
                        otab.tBodies[0].rows[i].style.background = '#FFFF00';
                    }
                }
            };
        </script>

  • 相关阅读:
    查windows系统开关机记录
    HDU-6278-Jsut$h$-index(主席树)
    POJ-2104-Kth Number(主席树)
    HDU-6546-Function(贪心)
    POJ-1523-SPF(求割点)
    POJ-2762-Going from u to v or from v to u(强连通, 拓扑排序)
    POJ-2552-The Bottom of a Graph 强连通分量
    POJ-1659-Frogs' Neighborhood
    POJ-1904-King‘s Quest
    POJ-1236-Network of Schools
  • 原文地址:https://www.cnblogs.com/baobeiqi-e/p/9884842.html
Copyright © 2020-2023  润新知