-
Notifications
You must be signed in to change notification settings - Fork 0
/
lights.html
152 lines (139 loc) · 4.18 KB
/
lights.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
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<style>
div.hey1 {
width: 10px;
position: fixed;
height: 10px;
border-radius: 50%;
background-color: #fff;
box-shadow:
0 0 60px 30px #fff, /* inner white */
0 0 100px 60px #FFFF00, /* middle yellow */
0 0 140px 90px #0ff; /* outer cyan */
}
div.hey2 {
width: 10px;
position: fixed;
height: 10px;
border-radius: 50%;
background-color: #fff;
box-shadow:
0 0 60px 30px #fff, /* inner white */
0 0 100px 60px #FFFF00, /* middle yellow */
0 0 140px 90px #0ff; /* outer cyan */
}
div.hey3 {
width: 10px;
position: fixed;
right: 0;
height: 10px;
border-radius: 50%;
background-color: #fff;
box-shadow:
0 0 60px 30px #fff, /* inner white */
0 0 100px 60px #FFFF00, /* middle yellow */
0 0 140px 90px #0ff; /* outer cyan */
}
div.hey4{
position:fixed;
bottom:40px;
width: absolute;
height: absolute;
background-color: #808080;
box-shadow: 0px 0px 10px 10px #808080;
}
div.hey5{
position:fixed;
bottom:40px;
width: absolute;
left:600px;
height: absolute;
background-color: #808080;
box-shadow: 0px 0px 10px 10px #808080;
}
div.hey6{
position:fixed;
bottom:40px;
right:0;
width: absolute;
height: absolute;
background-color: #808080;
box-shadow: 0px 0px 10px 10px #808080;
}
div.text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
co
}
</style>
<body background="img/index.jpg">
<br><br>
<div id = "hey1" class="hey1" style="display:none;"></div>
<center><div id="hey2" class="hey2" style="display:none;"></div></center>
<div id="hey3" class="hey3" style="display:none;"></div>
<div style="color:#FFFFFF" class="text">
<h1>Javascript: lights turn on/off</h1>
<h4>(To turn it on click on top side of button and to turn it off click on down side of the button)</h4>
</div>
<div class = "hey4" style="background-color: #808080; color:white; padding:20px;">
<div id="demo1" class = "demo1" onclick="myFunction1()" style="background-color: white; color:white; padding:20px;">
On
</div>
<div id="demo2" onclick="myFunction2()" style="background-color: white; color:black; padding:20px;">
Off
</div>
</div>
<div class = "hey5" style="background-color: #808080; color:white; padding:20px;">
<div id="demo3" onclick="myFunction3()" style="background-color: white; color:white; padding:20px;">
On
</div>
<div id="demo4" onclick="myFunction4()" style="background-color: white; color:black; padding:20px;">
Off
</div>
</div>
<div class = "hey6" style="background-color: #808080; color:white; padding:20px;">
<div id="demo5" onclick="myFunction5()" style="background-color: white; color:white; padding:20px;">
On
</div>
<div id="demo6" onclick="myFunction6()" style="background-color: white; color:black; padding:20px;">
Off
</div>
</div>
</body>
<script>
function myFunction1() {
document.getElementById("demo2").style.background = "black";
document.getElementById("demo1").style.background = "black";
document.getElementById("hey1").style.display = 'inline';
}
function myFunction2() {
document.getElementById("demo1").style.background = "white";
document.getElementById("demo2").style.background = "white";
document.getElementById("hey1").style.display = 'none';
}
function myFunction3() {
document.getElementById("demo4").style.background = "black";
document.getElementById("demo3").style.background = "black";
document.getElementById("hey2").style.display = 'inline';
}
function myFunction4() {
document.getElementById("demo3").style.background = "white";
document.getElementById("demo4").style.background = "white";
document.getElementById("hey2").style.display = 'none';
}
function myFunction5() {
document.getElementById("demo6").style.background = "black";
document.getElementById("demo5").style.background = "black";
document.getElementById("hey3").style.display = 'inline';
}
function myFunction6() {
document.getElementById("demo5").style.background = "white";
document.getElementById("demo6").style.background = "white";
document.getElementById("hey3").style.display = 'none';
}
</script>
</html>