• 选li第几天数据这种类型


    li{
    background: #f7b00f;
    }
    li:hover{
    background: #204d9a;
    }
    li:nth-child(4n-1){ background:#204d9a; }
    li:nth-child(4n-1):hover{
    background: #f7b00f;
    }
    li:nth-child(4n-2){ background:#204d9a; }
    li:nth-child(4n-2):hover{ background:#f7b00f; }

    /* 1,4,5,8,9,12,13,16,17,20,21,24,25,28,29,32,33,36,37,40,41,44,45,48,49 */

    富拓的像上面那些数字都是黄色背景

    js做法

    <script type="text/javascript">

    $(function(){


    /*var index = $(this).index()+1;

    var s=index%4;
    console.log(s);
    if(s == 0 || (s-1)%4==0){

    $(this).css("background", "green");
    }else{
    $(this).css("background", "red");
    }*/
    var obox=document.getElementById("box");

    var lis=obox.getElementsByTagName("li");

    for(var index=0;index<lis.length;index++){
    //lis[index].theIndex=index;
    if(index == 0 || (index-1)%4==0){
    $(this).css("background", "green");
    }else{
    $(this).css("background", "red");
    }
    //console.log(index)
    }



    $(".index").hover(function(){
    var index = $(this).index()+1;

    var s=index%4;
    console.log(s);
    if(s == 0 || (s-1)%4==0){

    $(this).css("background", "green");
    }else{
    $(this).css("background", "red");
    }
    },function(){
    var index = $(this).index()+1;
    var s=index%4;
    console.log(s);
    if(s == 0 || (s-1)%4==0){

    $(this).css("background", "#ffffff");
    }else{
    $(this).css("background", "#204d9a");
    }
    })

    });






    </script>

  • 相关阅读:
    【中山纪念中学六年级模拟赛】方格翻转 题解
    高斯消元
    net 控件开发资料
    使用自定义验证组件库扩展 Windows 窗体
    POJ 3032
    UVa 10878 Decode the tape
    C语言I博客作业03
    第十周助教总结
    第十二周助教总结
    C语言I博客作业06
  • 原文地址:https://www.cnblogs.com/lsc-boke/p/6386321.html
Copyright © 2020-2023  润新知