Skip to content

Commit dbe235b

Browse files
committed
light switch prep
1 parent 5aa72eb commit dbe235b

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed

.idea/vcs.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LightSwitch.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Light Switch</title>
6+
<style>
7+
8+
</style>
9+
<script>
10+
const on = "on.jpg", off = "off.jpg";
11+
12+
function switchLight() {
13+
var img = document.getElementsByTagName("img");
14+
if (img[0].src == "off.jpg") {
15+
img[0].src = "on.jpg";
16+
img[1].setAttribute("class", "sOn");
17+
} else {
18+
img[0].src = "off.jpg";
19+
img[1].setAttribute("class", "sOff");
20+
}
21+
}
22+
23+
</script>
24+
</head>
25+
<body>
26+
<div id="bulb">
27+
<img src="off.jpg"/>
28+
</div>
29+
<div id="switch">
30+
<img src="switch.png" onclick="switchLight()"/>
31+
</div>
32+
</body>
33+
</html>

off.jpg

37.1 KB
Loading

on.jpg

33.6 KB
Loading

switch.png

7.77 KB
Loading

0 commit comments

Comments
 (0)