-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex6.html
More file actions
135 lines (121 loc) · 3.76 KB
/
index6.html
File metadata and controls
135 lines (121 loc) · 3.76 KB
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
<!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>11</title>
<style type="text/css">
.top-nav {
font-size: 14px;
font-weight: bold;
list-style: none;
}
.top-nav li {
float: left;
margin-right: 1px;
}
.top-nav li a {
line-height: 34px;
text-decoration: none;
background: #3f240e;
color: #fff;
display: block;
width: 80px;
text-align: center;
}
.top-nav ul {
list-style: none;
padding: 0;
position: absolute;
height: 0;
overflow: hidden;
}
.top-nav li a:hover {
background: url(http://img.mukewang.com/5461b50d0001e28000010034.jpg) 0 0 repeat-x;
}
.note {
color: #3f240e;
display: block;
background: url(http://img.mukewang.com/5461b50d0001e28000010034.jpg) 0 0 repeat-x;
}
.corner {
display: block;
height: 11px;
background: url(http://img.mukewang.com/5461b5620001410d00170011.jpg) 31px 0 no-repeat;
}
</style>
<script type="text/javascript">
window.onload = function () {
//鼠标经过时的效果
var Lis = document.getElementsByTagName("li");
for (var i = 0; i < Lis.length; i++) {
Lis[i].onmouseover = function () {
var u = this.getElementsByTagName("ul")[0];
if (u != undefined) {
ChangeH(u.id, 1);
}
}
Lis[i].onmouseleave = function () {
var u = this.getElementsByTagName("ul")[0];
if (u != undefined) {
ChangeH(u.id, -1);
}
}
}
}
function ChangeH(id, count) {
// 根据ID找到ulList,同时得到其高度
var ulList = document.getElementById(id);
var h = ulList.offsetHeight;
h += count;
if (count > 0) {
if (h <= 42) {
// 将高度赋值给ulList,同时,不断调用本函数
ulList.style.height = h + "px";
ulList.style.display = "block";
setTimeout("ChangeH('" + id + "',1)", 10);
} else {
return;
}
} else {
if (h > 0) {
// 将高度赋值给ulList,同时,不断调用本函数
ulList.style.height = h + "px";
setTimeout("ChangeH('" + id + "',-1)", 10);
} else {
ulList.style.display = "none";
return;
}
}
}
</script>
</head>
<body>
<ul class="top-nav">
<li>
<a href="#">
<span class="note">慕课网</span>
</a>
</li>
<li>
<a href="#">课程大厅</a>
</li>
<li>
<a href="#">学习中心</a>
<ul id="mnuUL">
<span class="corner"></span>
<li>
<a href="#">前端课程 </a>
</li>
<li>
<a href="#">手机开发</a>
</li>
<li>
<a href="#">后台编程</a>
</li>
</ul>
</li>
<li>
<a href="#">关于我们</a>
</li>
</ul>
</body>
</html>