-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolors.html
27 lines (27 loc) · 841 Bytes
/
colors.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Colors</title>
<script>
document.addEventListener('DOMContentLoaded', () => {
document.querySelector("select").onchange = function() {
document.querySelector("#hello").style.color = this.value;
};
});
</script>
</head>
<body>
<h1 id="hello">Hello!</h1>
<select name="color">
<option value="black">Black</option>
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
<option value="gold">Gold</option>
<option value="yellow">Yellow</option>
<option value="orange">Orange</option>
</select>
</body>
</html>