vencinachev

Lamp control v2

Apr 19th, 2021
506
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <title>Hello JS</title>
  5.         <script>
  6.            var isOn = false;
  7.            function lampControl(){
  8.                if (!isOn){
  9.                    document.getElementById("lampImg").src = "pic_bulbon.gif";
  10.                    document.getElementById("lampBtn").innerHTML = "LAMP OFF";
  11.                } else {
  12.                    document.getElementById("lampImg").src = "pic_bulboff.gif";
  13.                    document.getElementById("lampBtn").innerHTML = "LAMP ON";
  14.                }
  15.                isOn = !isOn;
  16.            }
  17.         </script>
  18.     </head>
  19.     <body>
  20.         <button onclick="lampControl()" id="lampBtn"> LAMP ON </button>
  21.         <img src="pic_bulboff.gif" id="lampImg">
  22.     </body>
  23. </html>
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×