-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBulb.html
48 lines (43 loc) · 1.61 KB
/
Bulb.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<style>
body{
background-color: cadetblue;
}
</style>
</head>
<body>
<center>
<div class="container">
<h1>
Can you turn the light on? 💡
</h1>
<button id="light" type="button" class="btn btn-warning" onclick="light_on()">
Turn the light on
</button>
<img id="img" src="https://www.w3schools.com/js/pic_bulboff.gif" width="200px" height="300px">
<button id="light" type="button" class="btn btn-warning" onclick="light_off()">
Turn the light off</button>
</div>
</center>
<script>
const image=document.getElementById("img");
const light_on=()=>{
image.src="https://www.w3schools.com/js/pic_bulbon.gif";
}
const image2=document.getElementById("img");
const light_off=()=>{
image2.src="https://www.w3schools.com/js/pic_bulboff.gif";
}
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous">
</script>
</body>
</html>