• 菜单


    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>无标题文档</title>
    </head>
    <style>

    *{margin:0;padding:0;list-style:none;}
    #menu{position:relative; 960px;height:40px;margin:50px auto;}
    #tab{height:40px;line-height:40px;background:red;border-radius:20px;}
    #tab a{text-decoration:none;color:#fff;font-size:16px;font-family:'Microsoft Yahei';padding:3px 15px; margin-left:50px;}
    #tab a:hover{color:red;background:yellow;border-radius:20px;}
    .ulMenu{position:absolute;top:50px;450px;display:none;height:40px;line-height:40px;background:red;border-radius:20px;}
    .ulMenu li{float:left;margin-left:50px;}

    .menu1{left:0;}
    .menu2{left:126px;}
    .menu3{left:260px;}
    .menu4{left:400px;}

    </style>

    <script>

    window.onload = function()
    {

    var aA = document.getElementById('tab').getElementsByTagName('a');
    var aUl = document.getElementById('menu').getElementsByTagName('ul');

    var len = aA.length;
    var timer = null;

    var num = 0;

    for(var i=0;i<len;i++)
    {
    aA[i].index = i;
    aUl[i].index = i;
    aUl[i].onmouseover = aA[i].onmouseover = function()
    {
    num = this.index;
    show()
    };

    aUl[i].onmouseout = aA[i].onmouseout = function()
    {
    num = this.index;
    hide();
    };


    };

    function show()
    {

    clearTimeout( timer );
    for(var i=0;i<len;i++)
    {
    aUl[i].style.display = 'none';
    };
    aUl[num].style.display = 'block';
    };

    function hide()
    {
    clearTimeout(timer);
    timer = setTimeout(function(){
    aUl[num].style.display = 'none';
    },300);
    };


    };

    </script>

    <body>

    <div id="menu">

    <div id="tab">
    <a href="#">菜单一</a>
    <a href="#">菜单二</a>
    <a href="#">菜单三</a>
    <a href="#">菜单四</a>
    </div>

    <ul class="ulMenu menu1">
    <li>菜单一</li>
    <li>菜单一</li>
    <li>菜单一</li>
    <li>菜单一</li>
    </ul>
    <ul class="ulMenu menu2">
    <li>菜单2</li>
    <li>菜单一</li>
    <li>菜单一</li>
    <li>菜单一</li>
    </ul>
    <ul class="ulMenu menu3">
    <li>菜单3</li>
    <li>菜单一</li>
    <li>菜单一</li>
    <li>菜单一</li>
    </ul>
    <ul class="ulMenu menu4">
    <li>菜单4</li>
    <li>菜单一</li>
    <li>菜单一</li>
    <li>菜单一</li>
    </ul>

    </div>

    </body>
    </html>

  • 相关阅读:
    随记(二)--是否能打开手机某个应用
    asp.net 登陆后在ashx处理程序中获取不到Session
    Highcharts Pie 饼图提示标签IE下重叠解决方法,及json数据绑定方法
    怎样用ZBrush对模型进行渲染(二)
    怎样用ZBrush对模型进行渲染
    ZBrush中该如何调节多个SubTool
    如何用ZBrush快速绘制身体
    MIDI信息为什么不能通过FL Studio输出
    怎样制作FL Studio步进音序器中的节奏
    不同材质怎么通过ZBrush赋予同一个模型上
  • 原文地址:https://www.cnblogs.com/gyc51/p/8514177.html
Copyright © 2020-2023  润新知