forked from Duke-PL-Course/JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreview.html
More file actions
48 lines (47 loc) · 1.18 KB
/
review.html
File metadata and controls
48 lines (47 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
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Review Problem: Identifying Child Elements</title>
<style>
div#container {
display: block;
width: 200px;
margin: auto;
}
h3 {
text-align: center;
}
ul {
padding: 15px 25px;
border: 1px solid #000;
}
li {
margin: 5px 0;
padding: 5px;
border: 1px solid #00F;
font-weight: bold;
text-align: center;
list-style: none;
}
</style>
</head>
<body>
<div id="container">
<h3 id="list-title"></h3>
<ul id="list" style="background-color: #EEE;"></ul>
</div>
<script>
var numItems = Math.floor(Math.random() * 10 + 5),
list = document.getElementById('list'),
i, currItem;
document.getElementById('list-title').innerHTML = numItems + "-list";
console.log('Generating ' + numItems + ' list items.');
for (i = 0; i < numItems; i++) {
currItem = document.createElement('li');
currItem.innerHTML = "Click me!";
list.appendChild(currItem);
}
</script>
<script src="./review.js"></script>
</body>
</html>