• Javascript+css实现下拉菜单


    <!--程序2-11-menu.html-->
    <html>
    <head>
        <title> 下拉菜单实例</title>
    <script language = "javaScript">
    //鼠标移动到菜单选项时显示对应的div
    function show(menu)
    {document.getElementById(menu).style.visibility = "visible";}
    //当鼠标移出时隐藏所有div
    function hide()
    {document.getElementById("menu1").style.visibility = "hidden";
    document.getElementById("menu2").style.visibility = "hidden";
    document.getElementById("menu3").style.visibility = "hidden";
    }
    </script>
    </head>
    <body>
    <table>
    <tr bgcolor = "#9999FF" align = "center">
    <td width = "120" onMouseMove = "show('menu1')" onMouseOut = "hide()">系列课程</td>
    <td width = "120" onMouseMove = "show('menu2')" onMouseOut = "hide()">教学课件</td>
    <td width = "120" onMouseMove = "show('menu3')" onMouseOut = "hide()">课程大纲</td>
    </tr>
    </table>
    <div id = "menu1" onMouseMove = "show('menu1')" onMouseOut =  "hide()"
        style = "background:#9999ff;position:absolute;left:12;top=38;width=120;
        visibility : hidden">
        <span>c++</span><br>
        <span>java</span><br>
        <span>c#</span><br>
    </div>
    <div id = "menu2" onMouseMove = "show('menu2')" onMouseOut =  "hide()"
        style = "background:#9999ff;position:absolute;left:137;top=38;width=120;
        visibility : hidden">
        <span>c++课件</span><br>
        <span>java课件</span><br>
        <span>c#课件</span><br>
    </div>
    <div id = "menu3" onMouseMove = "show('menu3')" onMouseOut =  "hide()"
        style = "background:#9999ff;position:absolute;left:260;top=38;width=120;
        visibility : hidden">
        <span>c++大纲</span><br>
        <span>java大纲</span><br>
        <span>c#大纲</span><br>
    </div>
    </body>
    </html>

     onMouseMove在鼠标移动时就会响应onMouseOver 在鼠标进入响应区域时响应

  • 相关阅读:
    AspNetPager多参数传值
    PHP5.3不支持zend debugger, 安装Xdebug调试工具
    WebClient模拟Post发送接收数据
    Newtonsoft.Json序列化和反序列
    VS.PHP 调试错误:Apache Http server已停止工作
    Ubuntu 10.04 下 xampp 安装教程
    java之递归学习
    产品经理值得交的10个朋友
    不用windows安装盘安装64位win7或windows server 2008的方法(32位winpe下安装64位的办法)
    全生命周期研发流程
  • 原文地址:https://www.cnblogs.com/gride-glory/p/7828068.html
Copyright © 2020-2023  润新知