<body> <head> <style> button { padding:10px; margin:60px; background-color:orange; } </style> </head> <script> function light(value) { var pic; if(value == 0) { img="light-bulb-off.png"; } else { img="light-bulb-on.png"; } document.getElementById('bulb').src=img; } </script> <img id="bulb" src="light-bulb-off.png"> <br> <button onclick="light(1)">Turn ON</button> <button onclick="light(0)">Turn OF</button> </body>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)