forked from Return-Ready-PT-Tues-Thurs/JavaScript-DOM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTableContentsDOM.html
More file actions
67 lines (58 loc) · 1.77 KB
/
Copy pathTableContentsDOM.html
File metadata and controls
67 lines (58 loc) · 1.77 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Table of Contents</title>
<!-- <script> -->
<!-- function myFunction() { -->
<!-- document.getElementById("tableofcontents").innerHTML = "Table of Contents."; -->
<!-- } -->
<!-- </script> -->
</head>
<body>
<!-- <div > -->
<h1>Table of Contents</h1>
<!-- </div> -->
<!-- <hr/> -->
<!-- <div > -->
<!-- <h1>Fruits</h1> -->
<!-- <h2>Red Fruits</h2> -->
<!-- <h3>Apple</h3> -->
<!-- <h3>Raspberry</h3> -->
<!-- <h2>Orange Fruits</h2> -->
<!-- <h3>Orange</h3> -->
<!-- <h3>Tangerine</h3> -->
<!-- <h1>Vegetables</h1> -->
<!-- <h2>Vegetables Which Are Actually Fruits</h2> -->
<!-- <h3>Tomato</h3> -->
<!-- <h3>Eggplant</h3> -->
<!-- </div> -->
<ul id="Red Fruits">
<h2>Red Fruits</h2>
<li>Apple</li>
<li>Raspberry</li>
<ul id="Orange Fruits">
<h2>Orange Fruits</h2>
<li>Orange</li>
<li>Tangerine</li>
<ul id="Vegetables">
<h1>Vegetables</h1>
<p>Vegetables Which Are Actually Fruits</p>
<li>Tomato</li>
<!-- <li>Eggplant></li> -->
</ul>
<br>
<p>Click the button to append an item to the end of the list.</p>
<br>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var node = document.createElement("LI");
var textnode = document.createTextNode("Eggplant");
node.appendChild(textnode);
document.getElementById("Red Fruits").appendChild(node);
}
</script>
</body>
</html>