-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBulb_magic.html
More file actions
42 lines (41 loc) · 785 Bytes
/
Bulb_magic.html
File metadata and controls
42 lines (41 loc) · 785 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
36
37
38
39
40
41
42
<html>
<head>
<style>
#dv {
height: 50px;
width: 50px;
border-radius: 50%;
border: 5px solid black;
color: black;
text-align: center;
line-height: 50px;
font-size: 30px;
font-family: impact;
}
</style>
<script>
function demo() {
var dv1 = document.getElementById("dv");
var im = document.getElementById("img1");
if (dv1.innerText === "ON") {
dv1.innerText = "OFF";
dv1.style.border = "5px solid green";
dv1.style.color = "green";
im.src = "img/on.png";
} else {
dv1.innerText = "ON";
dv1.style.border = "5px solid red";
dv1.style.color = "red";
im.src = "img/off.png";
}
}
</script>
</head>
<body>
<center>
<img src="img/off.png" id="img1"/>
<br/><br/>
<div id="dv" onclick="demo()">ON</div>
</center>
</body>
</html>