-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdom_quiz.html
More file actions
29 lines (26 loc) · 800 Bytes
/
Copy pathdom_quiz.html
File metadata and controls
29 lines (26 loc) · 800 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
<!doctype html>
<html>
<head>
<script>
function do_something() {
var theBody = document.getElementsByTagName("body")[0];
var theImg = document.createElement("img");
theImg.src = "cat.png";
theBody.appendChild(theImg.cloneNode(true));
var count = 0;
for (var i = 0; i < 10; i++, count++) {
if (i == 5) continue;
if (count == 3) {
count = 0;
theBody.removeChild(theBody.lastChild);
} else {
theBody.appendChild(theImg.cloneNode(true));
}
if (i > 7) break;
}
}
</script>
<title>Dom Quiz</title>
</head>
<body onload="do_something()"></body>
</html>