码迷,mamicode.com
首页 > 编程语言 > 详细

python : HTML+CSS (左侧菜单)

时间:2016-11-18 06:41:35      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:python   class   click   ida   div   ide   exp   images   line   

左侧菜单

技术分享
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Title</title>
    <style>
       .hide{
            display: none;
        }
        .menu .head{
            height:38px;
            background-color: #2459a2;
            line-height: 38px;
        }
    </style>
</head>
<body>
<div style="height: 48px ;border: 1px solid red"></div>
<div style="width:300px ;border: 1px solid red ">
    <div class="menu">
           <div id=‘a1‘ class="head "  onclick="caidan(‘a1‘)">菜单1</div>
           <div class="conent">
                <div clas="item">内容1</div>
                <div clas="item">内容1</div>
                <div clas="item">内容1</div>
           </div>
    </div>

    <div class="menu">
           <div id=‘a2‘ class="head "   onclick="caidan(‘a2‘)">菜单2</div>
           <div class="conent hide">
                <div clas="item">内容2</div>
                <div clas="item">内容2</div>
                <div clas="item">内容2</div>
           </div>
    </div>

    <div class="menu">
           <div  id=‘a3‘ class="head"   onclick="caidan(‘a3‘)">菜单3</div>
           <div class="conent hide">
                <div clas="item">内容3</div>
                <div clas="item">内容3</div>
                <div clas="item">内容3</div>
           </div>
    </div>

    <div class="menu">
           <div id=‘a4‘ class="head"  onclick="caidan(‘a4‘)">菜单4</div>
           <div class="conent  hide">
                <div clas="item">内容4</div>
                <div clas="item">内容4</div>
                <div clas="item">内容4</div>
           </div>
    </div>

</div>
<script>

    function caidan(nod) {
        var head=document.getElementById(nod);
        curr_meu=head.parentElement.parentElement.children;
        for (var i=0; i<curr_meu.length; i++){
            var item_list=curr_meu[i];
            item_list.children[1].classList.add(hide);
        }
        head.nextElementSibling.classList.remove(hide)
    }
</script>
</body>
</html>
左侧菜单

 

python : HTML+CSS (左侧菜单)

标签:python   class   click   ida   div   ide   exp   images   line   

原文地址:http://www.cnblogs.com/xuehuahongmei/p/6076062.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!