-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbulbOn-off.html
36 lines (31 loc) · 1.27 KB
/
bulbOn-off.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bulb on off </title>
<script>
function OnOffButton() {
let onbulb = document.getElementById('onBulb');
let offBulb = document.getElementById('offBulb');
if(offBulb.style.display === "none")
{
onbulb.style.display = "none";
offBulb.style.display = "block";
}
else{
onbulb.style.display = "block";
offBulb.style.display = "none";
}
}
</script>
</head>
<body>
<div>
<img id="onBulb" src="https://media.geeksforgeeks.org/wp-content/uploads/OFFbulb.jpg" alt="no image">
<img id="offBulb" src="https://media.geeksforgeeks.org/wp-content/uploads/ONbulb.jpg" style = "display: none;" alt="no image">
<br>
<button onclick="OnOffButton()" style="height: 50px; width: 100px; background-color: cadetblue; font-size: 20px;">Toggle</button>
</div>
</body>
</html>