Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions JavaScript/Lesson 1/bulb.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<html>
<body>

<button
onclick="document.getElementById('myImage').src='pic_bulbon.gif'">
Turn on the light</button>

<img id="myImage" src="pic_bulboff.gif" style="width:100px">

<button
onclick="document.getElementById('myImage').src='pic_bulboff.gif'">
Turn off the light</button>

</body>
</html>






25 changes: 25 additions & 0 deletions JavaScript/Lesson 1/bulbscript.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<title>Light Switch</title>
</head>
<body>

<button onclick="turnOnLight()">Turn on the light</button>

<img id="myImage" src="pic_bulboff.gif" style="width:100px">

<button onclick="turnOffLight()">Turn off the light</button>

<script>
function turnOnLight() {
document.getElementById('myImage').src = 'pic_bulbon.gif';
}

function turnOffLight() {
document.getElementById('myImage').src = 'pic_bulboff.gif';
}
</script>

</body>
</html>
Binary file added JavaScript/Lesson 1/pic_bulboff.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added JavaScript/Lesson 1/pic_bulbon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.