-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex3b.html
More file actions
44 lines (42 loc) · 902 Bytes
/
ex3b.html
File metadata and controls
44 lines (42 loc) · 902 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Commas</title>
<style>
.odd {
background-color: #999999;
}
.even {
background-color: #333333;
color: #FFFFFF;
}
</style>
</head>
<body>
<div id="target"></div>
<script type="text/javascript">
var n = 8,
string ='';
while (n <= 8) {
if (n !== 8) {
if (n % 2 === 0) {
string += "<p class="even">"+ n +"</p><hr>";
} else {
string += "<p class="odd">"+ n +"</p><hr>";
}
} else {
if (n % 2 === 0) {
string += "<p class="even">"+ n +"</p><hr>";
} else {
string += "<p class="odd">"+ n +"</p><hr>";
}
string += "<p>"+ n +"</p><hr>";
}
}
n++;
}
document.querySelector('#target').innerHTML = string
</script>
</body>
</html>