Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <img id="testimg" src="https://www.w3schools.com/js/pic_bulboff.gif" />
- <button onclick="lightonfunction();">Light On</button>
- <button onclick="lightofffunction();">Light Off</button>
- <script>
- function lightonfunction(){
- document.getElementById('testimg').src = "https://www.w3schools.com/js/pic_bulbon.gif";
- }
- function lightofffunction(){
- document.getElementById('testimg').src = "https://www.w3schools.com/js/pic_bulboff.gif";
- }
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment