Write a JavaScript program for Light Bulb On/Off Animation.
<html>
<head>
<title>Light bulb on/off</title>
</head>
<body>
<img id="myImage" src="images/bulboff.jpg" width="100" height="100" onclick="changeBulb()"/>
<p>Click the light bulb to turn on/off the light.</p>
<script>
function changeBulb()
{
var image = document.getElementById("myImage");
if(image.src.match("bulbon"))
{
image.src = "images/bulboff.jpg";
}
else
{
image.src = "images/bulbon.jpg";
}
}
</script>
</body>
</html>
