水平导航-js二级菜单方法一

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>水平导航-二级菜单</title>
    <style type="text/css">
        *{
            padding:0px;
            margin: 0px;
        }
        .navBar{
            height: 30px;
            background-color: #2B383E;
            text-align: center;
        }
        ul{
            list-style: none;
        }
        .nav li{
            float: left;

        }
        .nav li a{
            display: block;
            padding: 0 20px;
            height: 30px;
            line-height: 30px;
            text-decoration: none;
            color: #fff;
        }
        .nav li a:hover{
            background-color: #fff;
            color: #4DB6E7
        }
        .TabMenuCon{
            clear: both;
            display: none;
        }
        .TabMenuCon li{
            display: inline-block;
        }
    </style>
    <script type="text/javascript">
        function selectTabMenu(i){
            switch(i){
           case 71:
                document.getElementById("TabMenuCon71").style.display="block";
                document.getElementById("TabMenuCon72").style.display="none";
                 document.getElementById("TabMenuCon73").style.display="none";
                document.getElementById("TabMenuCon74").style.display="none";
                document.getElementById("TabMenuCon75").style.display="none";
                document.getElementById("TabMenuCon76").style.display="none";
                break;
            case 72:
                document.getElementById("TabMenuCon71").style.display="none";
                document.getElementById("TabMenuCon72").style.display="block";
                document.getElementById("TabMenuCon73").style.display="none";
                document.getElementById("TabMenuCon74").style.display="none";
                document.getElementById("TabMenuCon75").style.display="none";
                document.getElementById("TabMenuCon76").style.display="none";
                break;
            case 73:
                document.getElementById("TabMenuCon71").style.display="none";
                document.getElementById("TabMenuCon72").style.display="none";
                document.getElementById("TabMenuCon73").style.display="block";
                document.getElementById("TabMenuCon74").style.display="none";
                document.getElementById("TabMenuCon75").style.display="none";
                document.getElementById("TabMenuCon76").style.display="none";
                break;
            case 74:
                document.getElementById("TabMenuCon71").style.display="none";
                document.getElementById("TabMenuCon72").style.display="none";
                document.getElementById("TabMenuCon73").style.display="none";
                document.getElementById("TabMenuCon74").style.display="block";
                document.getElementById("TabMenuCon75").style.display="none";
                document.getElementById("TabMenuCon76").style.display="none";
                break;
            case 75:
                document.getElementById("TabMenuCon71").style.display="none";
                document.getElementById("TabMenuCon72").style.display="none";
                document.getElementById("TabMenuCon73").style.display="none";
                document.getElementById("TabMenuCon74").style.display="none";
                document.getElementById("TabMenuCon75").style.display="block";
                document.getElementById("TabMenuCon76").style.display="none";
                break;
                case 76:
                document.getElementById("TabMenuCon71").style.display="none";
                document.getElementById("TabMenuCon72").style.display="none";
                document.getElementById("TabMenuCon73").style.display="none";
                document.getElementById("TabMenuCon74").style.display="none";
                document.getElementById("TabMenuCon75").style.display="none";
                document.getElementById("TabMenuCon76").style.display="block";
                break;
           }
        }
    </script>
</head>
<body>
    <div class="navBar">
        <ul class="nav">
            <li><a href="#" onmouseover="selectTabMenu(71)">首页</a></li>
            <li><a href="#" onmouseover="selectTabMenu(72)">关于协会</a></li>
            <li><a href="#" onmouseover="selectTabMenu(73)">协会动态</a></li>
            <li><a href="#" onmouseover="selectTabMenu(74)">协会活动</a></li>
            <li><a href="#" onmouseover="selectTabMenu(75)">会员</a></li>
            <li><a href="#" onmouseover="selectTabMenu(76)">资源空间</a></li>
        </ul>

    </div>
    <div id="TabMenuCon">
        <ul id="TabMenuCon71" class="TabMenuCon">
            <li>公告</li>
            <li>信息</li>
        </ul>
        <ul id="TabMenuCon72" class="TabMenuCon">
            <li>协会简介</li>
            <li>组织机构</li>
            <li>协会章程</li>
        </ul>
        <ul id="TabMenuCon73" class="TabMenuCon">
            <li>协会新闻</li>
            <li>活动预告</li>
            <li>求职招聘</li>
        </ul>
        <ul id="TabMenuCon74" class="TabMenuCon">
            <li>义务维修月</li>
            <li>平面设计活动</li>
            <li>程序设计活动</li>
            <li>户外拓展</li>
        </ul>
        <ul id="TabMenuCon75" class="TabMenuCon">
            <li>会员登录</li>
            <li>会员注册</li>
            <li>缴纳会费</li>
            <li>会员信息管理</li>
            <li>修改密码</li>
        </ul>
        <ul id="TabMenuCon76" class="TabMenuCon">
            <li>PS教程</li>
            <li>前端设计</li>
            <li>Flash教程</li>
        </ul>
    </div>

</body>
</html>
时间: 2024-10-21 12:49:58

水平导航-js二级菜单方法一的相关文章

dedecms织梦导航栏二级菜单的实现方法

dede导航下拉菜单,一级栏目增加二级下拉菜单 使用dedecms5.6——5.7 将这段代码贴到templets\default\head.htm文件里<!-- //二级子类下拉菜单,考虑SEO原因放置于底部  --><script type='text/javascript' src='{dede:global.cfg_cmsurl/}/images/js/dropdown.js'></script>{dede:channelartlist typeid='top'

Bootstrap系列 -- 40. 导航条二级菜单

在导航条中添加二级菜单也非常简单 <div class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <a href="##" class="navbar-brand">导航条</a> </div> <ul class="nav navb

ecshop简单三部实现导航分类二级菜单

1.在page_header.lbi对应的位置(你想显示导航的位置)插入 (注意下面的"themes/模板名称/util.php"中的"模板名称"改成你模板文件夹的名称) <?php require_once("themes/模板名称/util.php"); ?> <div class="header-menu"> <p {if $navigator_list.config.index eq 1}

兼容ie7的导航下拉菜单

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Typ

JS下滑菜单,向下滑出二级导航

<!DOCTYPE html><html><head><title>石家庄渣浆泵</title><style type="text/css">ul#sidemenu, ul#sidemenu ul{list-style-type: none;margin: 0;padding: 0;width: 185px;}ul#sidemenu a{display: block;text-decoration: none;}u

纯css实现的三级水平导航菜单

vscode练习使用开发纯css的三级水平导航菜单.先上图: 1.html5布局 1 <html> 2 3 <head> 4 <meta charset="UTF-8"> 5 <title>水平导航菜单</title> 6 <link rel="stylesheet" href="reset.css"> 7 <link rel="stylesheet"

五中常用简洁后台导航菜单(一级导航,二级导航,手风琴式导航,左或右悬浮式导航,树状导航)

首先附上源码,可以下载! http://yunpan.cn/cd9ivPcL4ayQT (提取码:d8a5) 在建立导航菜单的时候,我们首先布局一个(" 头"+[左,右(自适应)]+”尾“)的HTML页面: 来看一下HTML页面的编写: <div id="container"> <div id="head"></div> <div id="mainContent"> <di

js二级导航

js写二级导航要点 1.ul li 2.js获取元素 3.setInterval(function(),time); 代码如下 1 <style type="text/css"> 2 ul,li,body{margin:0;padding: 0;} 3 #nav{width: 500px;margin: 10px auto;} 4 ul li{list-style: none;} 5 .clear{clear: both;} 6 #nav>li{float: left

JS 学习制作一个二级菜单

1 <!DOCTYPE html> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>菜单栏</title> 5 <script src="jquery/jquery-2.1.1.js"></script> 6 <script> 7 $(document).ready(function () {