-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjava.html
More file actions
35 lines (29 loc) · 854 Bytes
/
java.html
File metadata and controls
35 lines (29 loc) · 854 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Color List</title>
</head>
<body>
<h2>Color List</h2>
<ul id="colorList">
<!-- Dynamic list items will be added here -->
</ul>
<script>
// Array of color names
var colors = ['red', 'green', 'blue', 'yellow', 'orange'];
// Get the ul element
var ul = document.getElementById('colorList');
// Loop through the colors array to create and append li elements
colors.forEach(function(color) {
// Create li element
var li = document.createElement('li');
// Set the text content of the li element to the color name
li.textContent = color;
// Append the li element to the ul element
ul.appendChild(li);
});
</script>
</body>
</html>