-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontainer.html
More file actions
92 lines (72 loc) · 2.57 KB
/
container.html
File metadata and controls
92 lines (72 loc) · 2.57 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Javascript: Lights Out!</title>
</head>
<body background="room4.jpg">
<img id="bulb" src="bulboff.png" width="80" height="120">
<img style="position: absolute; top: 10px; left: 950px;"
id="bulb1" src="bulboff.png" width="80" height="120">
<img style="position: absolute; top: 1px; left: 475px;"
id="lamp" src="lampoff.png" width="80" height="120">
<img
style="position: absolute; top: 500px; left: 390px;"
id="switch" onclick="changeImage()"
src="switchoff.png" width="80" height="70">
<img
style="position: absolute; top: 500px; left: 550px;"
id="switch1" onclick="changeImage1()"
src="switchoff.png" width="80" height="70">
<img
style="position: absolute; top: 500px; left: 470px;"
id="switch2" onclick="changeImage2()"
src="switchoff.png" width="80" height="70">
<script>
function changeImage()
{
var imageBulb = document.getElementById('bulb');
var imageSwitch = document.getElementById('switch');
if (imageBulb.src.match("bulbon"))
{
imageBulb.src = "bulboff.png";
imageSwitch.src = "switchoff.png";
}
else
{
imageBulb.src = "bulbon.png";
imageSwitch.src = "switchon.png";
}
}
function changeImage1()
{
var imageBulb1 = document.getElementById('bulb1');
var imageSwitch1 = document.getElementById('switch1');
if (imageBulb1.src.match("bulbon"))
{
imageBulb1.src = "bulboff.png";
imageSwitch1.src = "switchoff.png";
}
else
{
imageBulb1.src = "bulbon.png";
imageSwitch1.src = "switchon.png";
}
}
function changeImage2()
{
var imagelamp = document.getElementById('lamp');
var imageSwitch2 = document.getElementById('switch2');
if (imagelamp.src.match("lampon"))
{
imagelamp.src = "lampoff.png";
imageSwitch2.src = "switchoff.png";
}
else
{
imagelamp.src = "lampon.png";
imageSwitch2.src = "switchon.png";
}
}
</script>
</body>
</html>