博客列表 >选项卡-2018-04-02

选项卡-2018-04-02

彪小A的博客
彪小A的博客原创
2018年04月02日 14:49:30444浏览
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>选项卡</title>
    <style type="text/css">
        h2{text-align: center;
        }
        .box{
            width: 538px;
            height: 500px;
            background-color: white;
            border: 1px solid #ccc;
            margin: 20px auto;
            color: #363636;
        }
        .box > ul{
            background-color: #f8f8f8;
            padding: 0;
            margin: 0;
            overflow: hidden;
        }
        .box > ul li{
            list-style-type: none;
            width: 90px;
            height: 36px;
            float: left;
            border-right: 1px solid #cccccc;
            border-bottom: 1px solid #cccccc;
            text-align: center;
            line-height: 33px;
        }
        .box > ul + span{
            float: right;
            width: 90px;
            height: 36px;
            text-align: center;
            margin-top: -36px;
            line-height: 36px;
        }
        .box > ul + span >a{
            color: #696969;
            text-decoration: none;
        }
        .box li.active{
            background-color: #fff;
            font-weight: bolder;
            border-bottom: none;
            border-top: 3px solid orangered;
        }
        .box div{
            display: none;

        }
        .box div ul{
            margin: 0;
            padding: 0;
            list-style-type: none;
            overflow: hidden;
        }
        .box div ul li{
            font-size: 13px;
            line-height: 1.5em;
            margin: 5px 5px;
        }
        .box div ul li a{
            color: #696969;
            text-decoration: none;
        }
        .box div ul li a:hover{
            color: #000;
        }
        .box div ul li span{
            float: right;
            color: red;

        }
    </style>
</head>
<body>
    <h2>选项卡</h2>
    <div class="box">
        <ul>
            <li class="active">技术文章</li>
            <li>网站源码</li>
            <li>原生手册</li>
            <li>推荐博文</li>
        </ul>
        <span><a href="">更多下载&gt&gt</a></span>
        <!--技术文章-->
 <div style="display: block">
            <ul>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;JavaScript用递归方法实现颠倒栈的元素</a><span>2018-04-01</span></li>
            </ul>
        </div>

        <!--网站源码-->
 <div>
            <ul>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;彩色音乐扬声器娱乐网站模板</a><span>2018-04-01</span></li>
            </ul>
        </div>
        <!--原生手册-->
 <div>
            <ul>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;CentOS7 安装 Mysql 5.7密码查看与修改</a><span>2018-04-01</span></li>
            </ul>
        </div>
        <!--推荐博客-->
 <div>
            <ul>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
                <li><a href="">JS教程&nbsp;|&nbsp;各大网站必用前端js选项卡</a><span>2018-04-01</span></li>
            </ul>
        </div>
    </div>
<script type="text/javascript">
    var box = document.getElementsByClassName("box")[0];
    var uls = box.getElementsByTagName('ul')[0];
    var tab = uls.getElementsByTagName('li');
    var list = box.getElementsByTagName('div');
    for (var i=0;i<tab.length;i++){
        tab[i].index = i;
        tab[i].onmouseover = function () {
            for(var i=0;i<tab.length;i++){
                tab[i].className = "";
                list[i].style.display = 'none';
            }
            this.className = "active";
            list[this.index].style.display = 'block';
        };
    }

</script>
</body>
</html>

控制div的显示隐藏:display:none隐藏  display:block 显示

设置一个元素的样式 className

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议