码迷,mamicode.com
首页 > 其他好文 > 详细

菜单打开关闭效果

时间:2018-01-01 23:38:43      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:bsp   pos   script   isp   ==   :hover   function   splay   inter   

菜单打开关闭效果

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>菜单打开关闭</title>
<style type="text/css">
*{ margin:0px auto; padding:0px;}
.as{margin-top:50px; width:202px; height:52px;}
.zs{width:200px; height:50px; border:1px solid #000; text-align:center; vertical-align:middle; line-height:52px; background-color:#00F; margin-top:5px;}
.zs:hover{ cursor:pointer}
.a{ width:200px; height:50px; border:1px solid #000; text-align:center; vertical-align:middle; line-height:52px;  background-color:#00f;}
.bb{width:202px;height:160px; margin-left:0px; display:none;}
</style>
</head>

<body>
<div class="as">
    <div class="zs" onclick="cc(‘ff‘)">00</div>
        <div class="bb" id="ff" sx="1">
            <div class="a">11</div>
            <div class="a">22</div>
            <div class="a">33</div>
        </div>
        <div class="zs" onclick="cc(‘ff1‘)">00</div>
        <div class="bb" id="ff1" sx="1">
            <div class="a">11</div>
            <div class="a">22</div>
            <div class="a">33</div>
        </div>
        <div class="zs" onclick="cc(‘ff2‘)">00</div>
        <div class="bb" id="ff2" sx="1">
            <div class="a">11</div>
            <div class="a">22</div>
            <div class="a">33</div>
        </div>
</div>

<script type="text/javascript">

function cc(id)
{
    var a1 = document.getElementById(id);
    if(a1.style.display=="block")
    {
        a1.style.display = "none";
        }else{
            a1.style.display = "block";
            }
    }
    
</script>
</body>
</html>

效果图:

技术分享图片

技术分享图片

 

菜单打开关闭效果

标签:bsp   pos   script   isp   ==   :hover   function   splay   inter   

原文地址:https://www.cnblogs.com/Whitehat/p/8168939.html

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