payal-kothari
7/27/2017 - 5:06 PM

From https://www.w3schools.com/js/tryit.asp?filename=tryjs_intro_lightbulb

<!DOCTYPE html>
<html>
<body>

<h2> My bulb example </h2>

<p> We will switch on/off the bulb </p>

<button onclick = 'document.getElementById("bulbImg").src= "pic_bulboff.gif"'> Switch Off </button>

<img id="bulbImg" src="pic_bulbon.gif" width="100px">

<button onclick = 'document.getElementById("bulbImg").src= "pic_bulbon.gif"'> Switch On </button>

</body>
</html>