Tryit Editor v1.4

<html> <head> <script type="text/javascript"> function lighton() { document.getElementById('myimage').src="bulbon.gif"; } function lightoff() { document.getElementById('myimage').src="bulboff.gif"; } </script> </head> <body> <img id="myimage" onmousedown="lighton()" onmouseup="lightoff()" src="bulboff.gif" width="100" height="180"> <p>Click to turn on the light</p> </body> </html> | Your Result:
Edit the code above and click to see the result. | W3Schools.com - Try it yourself