-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathonclick color change.html
More file actions
43 lines (31 loc) · 1.06 KB
/
onclick color change.html
File metadata and controls
43 lines (31 loc) · 1.06 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>click on the dropddown list and see the magic </h1>
<select name="color1" id="change" onchange="col(this.value)">
<option>Select the Color</option>
<option value="Red">Red</option>
<option value="green">Green</option>
<option value="Blue">Blue</option>
<option value="Yellow">Yellow</option>
<option value="cyan">cyan</option>
<option value="purple">purple</option>
</select>
<script>
function col(color) {
if (color == "Select the Color") {
alert(" please select the color")
}
else
var newwin = window.open("", "new page", "width =1440 , height = 600")
newwin.document.write("color is changed to " + color)
newwin.document.body.style.backgroundColor = color;
}
</script>
</body>
</html>