二级菜单

来源:互联网 发布:zepto.js animate 编辑:程序博客网 时间:2024/04/19 08:30
 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!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>
    <title>通用的二级菜单</title>
    <style type="text/css">
    #menu
    {
        width:300px;
        margin:auto;
    }
#div1
{
display:none;
font-size:12px;
position:relative;
left:0px;
top:0px;
background-color:White;
padding:5px 10px 0px 10px;
width:320px;
}
#div2
{
display:none;
font-size:12px;
position:relative;
left:50px;
top:0px;
background-color:White;
padding:5px 10px 0px 10px;
width:320px;
}
#div3
{
display:none;
font-size:12px;
position:relative;
left:120px;
top:0px;
background-color:White;
padding:5px 10px 0px 10px;
width:320px;
}
#div4
{
display:none;
font-size:12px;
position:relative;
left:200px;
top:0px;
background-color:White;
padding:5px 10px 0px 10px;
width:320px;
}
    </style>
    <script language="javascript" type="text/javascript">
        //显示层
        function showDiv(divName) {
            document.getElementById(divName).style.display = "block";
        }
        //隐藏层
        function hiddenDiv(divName) {
            document.getElementById(divName).style.display = "none";
        }
    </script>
</head>
<body>
<div id="menu">
<a href="#" onmouseover="showDiv('div1')" onmouseout="hiddenDiv('div1')">菜单一</a>
 | 
<a href="#" onmouseover="showDiv('div2')" onmouseout="hiddenDiv('div2')">菜单二</a>
 | 
<a href="#" onmouseover="showDiv('div3')" onmouseout="hiddenDiv('div3')">菜单三</a>
 | 
<a href="#" onmouseover="showDiv('div4')" onmouseout="hiddenDiv('div4')">菜单四</a>
<div id="div1" onmouseover="showDiv(this.id)" onmouseout="hiddenDiv(this.id)">
<a href="#">子菜单一</a>
</div>
<div id="div2" onmouseover="showDiv(this.id)" onmouseout="hiddenDiv(this.id)">
<a href="#">子菜单一</a>
<a href="#">子菜单二</a>
</div>
<div id="div3" onmouseover="showDiv(this.id)" onmouseout="hiddenDiv(this.id)">
<a href="#">子菜单一</a>
<a href="#">子菜单二</a>
<a href="#">子菜单三</a>
</div>
<div id="div4" onmouseover="showDiv(this.id)" onmouseout="hiddenDiv(this.id)">
<a href="#">子菜单一</a>
<a href="#">子菜单二</a>
<a href="#">子菜单三</a>
<a href="#">子菜单四</a>
</div>
</div>
</body>
</html>

原创粉丝点击