css 二级菜单
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
| <style type="text/css">
.divclass
{
display:none;
font-size:12px;
position:relative;
left:0px;
top:0px;
padding:5px 10px 0px 10px;
width:320px;
}
</style>
<script language="javascript" type="text/javascript">
function showDiv(divName)
{
if (document.getElementById(divName).style.display == "block")
document.getElementById(divName).style.display = "none"; //隐藏层
else
document.getElementById(divName).style.display = "block"; //显示层
}
</script>
</head>
<body>
<div id="menu">
<ul>
<li><a href="#" onmousedown="showDiv('div1')">菜单一</a></li>
<div id="div1" class=divclass>
<a href="#" onmousedown="showDiv('div2')">子菜单一</a>
<div id="div2" class=divclass>
<ul>
<li><a href="#">子菜单一</a></li>
<li><a href="#">子菜单二</a></li>
<ul>
</div>
</div>
<li><a href="#" onmousedown="showDiv('div3')">菜单三</a></li>
<div id="div3" class=divclass>
<ul>
<ul>
</div>
<li><a href="#" onmousedown="showDiv('div4')">菜单四</a></li>
<div id="div4" class=divclass>
<ul>
<li><a href="#">子菜单一</a></li>
<li><a href="#">子菜单二</a></li>
<ul>
</div>
</ul>
</div>
</body>
</html>
<script language="javascript" type="text/javascript">
showDiv('div1');
</script>
|