forked from WangJia-mm/JavaScript201708
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2-lineChange.html
More file actions
63 lines (55 loc) · 1.18 KB
/
Copy path2-lineChange.html
File metadata and controls
63 lines (55 loc) · 1.18 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>隔行变色-珠峰培训</title>
<style>
* {
margin: 0;
padding: 0;
font-size: 14px;
}
ul {
list-style: none;
}
.cataLog {
margin: 50px;
width: 300px;
}
.cataLog li {
line-height: 35px;
border-bottom: 1px dashed #999;
}
.bg1 {
background: lightcyan;
}
.bg2 {
background: lightgoldenrodyellow;
}
.bg3 {
background: lightgrey;
}
.bg {
background: lightpink;
}
</style>
</head>
<body>
<ul class="cataLog" id="cataLog">
<li>HTML(HTML5)</li>
<li>CSS(CSS3)</li>
<li>JS(JQ/ZEPTO...)</li>
<li>移动端开发</li>
<li>VUE</li>
<li>REACT</li>
<li>NODE</li>
</ul>
<script>
var cataLog = document.getElementById('cataLog'),
cataLogList = cataLog.getElementsByTagName('li');
for (var i = 0, len = cataLogList.length; i < len; i++) {
cataLogList[i].className = 'bg' + (i % 2 + 1);
}
</script>
</body>
</html>