-
Notifications
You must be signed in to change notification settings - Fork 1
/
横向二级菜单.html
154 lines (141 loc) · 2.85 KB
/
横向二级菜单.html
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<html>
<head>
<meta http-equiv="Content-Type" content="content-type:text/html;charset=utf-8">
<style type="text/css">
body {
font: normal 14px/1.5em Verdana, Lucida, Arial, Helvetica, sans-serif;
}
ul {
width: 400px;
margin: 0;
padding: 0;
list-style: none;
border-right: 1px solid #ccc;
}
ul:after {
display: block;
visibility: hidden;
font-size: 0;
line-height: 0;
clear: both;
content: "";
}
#nav li {
position: relative;
float: left;
width: 100px;
height: 30px;
}
#nav li ul {
display: none;
position: absolute;
width: 100%;
left: 0;
top: 30px;
}
ul li a {
display: block;
height: 28px;
overflow: hidden;
line-height: 30px;
text-align: center;
text-decoration: none;
color: #777;
border: 1px solid #ccc;
border-right: 0px;
background: #fff;
}
ul li li {
margin-top: -1px;
}
#nav li:hover ul, #nav li.over ul {
display: block;
}
/* 针对IE6在触发弹出层时的错位解决方案 */
* html ul li {float:left;zoom:1;}
* html ul li a {zoom:1;}
</style>
</head>
<body>
<ul id="nav">
<li>
<a href="#">首页</a>
</li>
<li>
<a href="#">关于我</a>
<ul>
<li>
<a href="#">profile</a>
</li>
<li>
<a href="#">github</a>
</li>
</ul>
</li>
<li>
<a href="#">我的前端</a>
<ul>
<li>
<a href="#">xhtml+css</a>
</li>
<li>
<a href="#">javascript</a>
</li>
<li>
<a href="#">nodejs</a>
</li>
<li>
<a href="#">mongodb</a>
</li>
</ul>
</li>
<li>
<a href="#">我的朋友</a>
<ul>
<li>
<a href="#">男生</a>
</li>
<li>
<a href="#">女生</a>
</li>
</ul>
</li>
</ul>
<script type="text/javascript">
fnStartList = function() {
if(document.all && document.getElementById) {
navRoot = document.getElementById("nav");
var i,
len = navRoot.childNodes.length;
for(i=10; i<len; i++) {
node = navRoot.childNodes[i];
if(node.nodeName === "LI") {
node.onmouseover = function(){
this.className +=" over";
}
node.onmouseout = function() {
this.className = this.className.replace(" over","");
}
}
}
} else if(document.getElementById){
navRoot = document.getElementById("nav");
var i,
len = navRoot.childNodes.length;
for(i=10; i<len; i++) {
node = navRoot.childNodes[i];
if(node.nodeName === "LI") {
node.onmouseover = function(){
this.className +=" over";
}
node.onmouseout = function() {
this.className = this.className.replace(" over","");
}
}
}
}
}
window.onload = fnStartList;
</script>
</body>
</html>