zoukankan      html  css  js  c++  java
  • 选项卡制作

    <!DOCTYPE html>
    <html>
    <head lang="en">
    <meta charset="UTF-8">
    <title>实践题 - 选项卡</title>
    <style type="text/css">
    /* CSS样式制作 */
    li{
    list-style-type:none;
    border:1px solid GRAY;
    border-bottom:2px solid red;
    display:inline-block;//这里的设置就使列横向排列了
    line-height:2em;
    padding:0 1em;
    cursor:pointer;//cursor 属性规定要显示的光标的类型(形状)。该属性定义了鼠标指针放在一个元素边界范围内时所用的光标形状;

    ul{margin-left:-35px;}
    div{
    border:1px solid gray;
    350px;
    margin-top:-18px;
    }
    .currentd{
    border-top:2px solid red;
    }
    .currentl{
    border-top:2px solid red;
    border-bottom:2px solid white;
    }
    .show{display:block;}
    .hide{display:none;}
    </style>
    <script type="text/javascript">
    var xli=document.getElementsByTagName("li");
    var xdiv=document.getElementsByTagName("div");
    function change(x){
    for(var i=0;i<xli.length;i++){
    if(xli[i]!=x){
    xli[i].className="";
    xdiv[i].className="hide";
    };
    if(xli[i]==x){
    x.className="currentl";
    xdiv[i].className="show currentd"
    };
    };

    };
    // JS实现选项卡切换


    </script>

    </head>
    <body>
    <!-- HTML页面布局 -->

    <ul>
    <li class="currentl" onmouseover="change(this)">房产</li>
    <li onmouseover="change(this)">家居</li>
    <li onmouseover="change(this)">二手房</li>
    </ul>
    <div id="house" class="currentd">
    <p>275万购昌平邻铁三居 总价20万买一居</p>
    <p>200万内购五环三居 140万安家东三环</p>
    <p>北京首现零首付楼盘 53万购东5环50平</p>
    <p>京楼盘直降5000 中信府 公园楼王现房</p>
    </div>
    <div id="home" class="hide">
    <p>40平出租屋大改造 美少女的混搭小窝</p>
    <p>经典清新简欧爱家 90平老房焕发新生</p>
    <p>新中式的酷色温情 66平撞色活泼家居</p>
    <p>瓷砖就像选好老婆 卫生间烟道的设计</p>
    </div>
    <div id="shand" class="hide">
    <p>通州豪华3居260万 二环稀缺2居250w甩</p>
    <p>西3环通透2居290万 130万2居限量抢购</p>
    <p>黄城根小学学区仅260万 121平70万抛!</p>
    <p>独家别墅280万 苏州桥2居优惠价248万</p>
    </div>


    </body>
    </html>

    结果如图:

  • 相关阅读:
    Android的数据存储
    Servlet第一天
    JavaScript高级程序设计读书笔记(3)
    Interesting Papers on Face Recognition
    Researchers Study Ear Biometrics
    IIS 发生意外错误 0x8ffe2740
    Father of fractal geometry, Benoit Mandelbrot has passed away
    Computer vision scientist David Mumford wins National Medal of Science
    Pattern Recognition Review Papers
    盒模型bug的解决方法
  • 原文地址:https://www.cnblogs.com/fireporsche/p/6226732.html
Copyright © 2011-2022 走看看