-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtab.html
More file actions
222 lines (216 loc) · 4.91 KB
/
tab.html
File metadata and controls
222 lines (216 loc) · 4.91 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>tab选项卡</title>
<style type="text/css">
*{
margin:0;
padding:0;
list-style:none;
font-size:12px;
}
.notice{
width:306px;
height:98px;
margin:10px;
border:3px solid #eee;
overflow:hidden;
}
.notice-tit{
height:27px ;
/*position:relative/
background:#f7f7f7;*/
}
.notice-tit ul{
/*position:absolute;*/
/*ul的宽度大于等于父div的宽度加上li的边框乘以2即可*/
width:310px;
margin-left:-2px;/* 向左缩进li边框的宽度 */
}
.notice-tit ul li{
float:left;
/*(li的宽度+padding的宽度*2)*li的个数=ul的最小宽度*/
width:58px;
/*height:26px;*/
padding:0 2px;
line-height:26px;
text-align:center;
overflow:hidden;
background:#eee;
border-bottom:1px silid #eee;
}
.notice li a:link,.notice-tit li a:visited{
text-decoration: none;
color:#000;
}
.notice li a:hover{
color:#f90;
}
.notice li.select{
background:#fff;
border-bottom:1px solid #fff;
border-left:2px solid #eee;
border-right:2px solid #eee;
padding:0;/*将padding的值置为0,同时增加左边框和右边框的值*/
font-weight:bolder;
}
.notice-con .mod{
margin:10px 10px 10px 20px ;
}
.notice-con .mod ul li{
float:left;
width:138px;
line-height:25px;
overflow:hidden;
}
</style>
</head>
<body>
<div id="notice" class="notice">
<div id="notice-tit" class="notice-tit">
<ul>
<li>
<a href="#">公告</a>
</li>
<li>
<a href="#">规则</a>
</li>
<li>
<a href="#">论坛</a>
</li>
<li>
<a href="#">安全</a>
</li>
<li class="select">
<a href="#">公益</a>
</li>
</ul>
</div>
<div id="notice-con" class="notice-con">
<div class="mod" style="display:none">
<ul>
<li>
<a href="#">走进无声课堂</a>
</li>
<li>
<a href="#">走进无声课堂</a>
</li>
<li>
<a href="#">走进无声课堂</a>
</li>
<li>
<a href="#">走进无声课堂</a>
</li>
</ul>
</div>
<div class="mod" style="display:none">
<ul>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
</ul>
</div>
<div class="mod" style="display:none">
<ul>
<li>
<span>[<a href="#">通知</a>]</span>
<a href="#">走进无声课堂</a>
</li>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
</ul>
</div>
<div class="mod" style="display:none">
<ul>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
</ul>
</div>
<div class="mod" style="display:block">
<ul>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
<li>
<span>[<a href="#">通知</a>]
<a href="#">走进无声课堂</a>
</li>
</ul>
</div>
</div>
</div>
<script type="text/javascript">
window.onload=function(){
//获取鼠标滑过或点击的标签和要切换内容的元素
var titContain=document.getElementById('notice-tit');
var titles=titContain.getElementsByTagName('li');
var conContain=document.getElementById('notice-con');
divs=conContain.getElementsByTagName('div');
//console.log(titles);
if(titles.length!=divs.length)
return;
//遍历titles下的所有li
for (var i = 0; i < titles.length; i++) {
titles[i].id=i;//添加索引
titles[i].onmouseover=function(){
for (var j = 0; j<titles.length; j++) {
//清除所有li上的class
titles[j].className='';
divs[j].style.display='none';
};
//设置当前为高亮显示
this.className='select';
divs[this.id].style.display='block';
}
};
}
</script>
</body>
</html>