zoukankan      html  css  js  c++  java
  • 简单的分页1

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">

    .tab-head div{
    80px;
    height: 40px;
    background-color: blue;
    margin-left: 30px;
    float: left;
    }
    /*.on代表选中的div*/
    .tab-head div.on{
    background-color: #E0FFFF;
    }
    .tab-body div{
    200px;
    height: 100px;
    background-color:wheat;
    margin-left: 30px;
    display: none;
    }
    .tab-body div.on{
    /*使选中的div成块状显示出来*/
    display: block;
    }
    </style>
    </head>
    <body>
    <div class="tab-box">
    <div class="tab-head">
    <div id="t1" class="on" onclick="test(1)">1</div>
    <div id="t2" onclick="test(2)">2</div>
    </div>
    <div class="tab-body">
    <div id="k1" class="on">111</div>
    <div id="k2">222</div>
    </div>
    </div>
    <script type="text/javascript">
    //使用函数的方法进行取值
    function $(id){
    return document.getElementById(id);
    }
    function test(num){
    for(var i=1;i<=2;i++){
    //清除class值
    $("t"+i).className="";
    $("k"+i).className="";
    }
    //设置新的class值
    $("t"+num).className="on";
    $("k"+num).className="on";
    }
    </script>
    </body>
    </html>

  • 相关阅读:
    优秀大整数
    洛谷—— P3908 异或之和
    洛谷—— P1869 愚蠢的组合数
    洛谷—— P1680 奇怪的分组
    洛谷—— P1609 最小回文数
    Something I like
    数学相关
    新博客测试中~
    P3369 【模板】普通平衡树
    2017 11.6 NOIP模拟赛
  • 原文地址:https://www.cnblogs.com/weixin2623670713/p/12944228.html
Copyright © 2011-2022 走看看