Your question i need to know the rule of "bulbon".
"
When you click on the image, the javascript is invoked and the if condition is checking which image you have clicked on.
In other words if (element.src.match("bulbon")) condition checks whether the image you clicked got the name string "bulbob" on its name
"
This works for me
<html>
<head>
<title></title>
<script>
function changeImage() {
element = document.getElementById('myimage')
if (element.src.match("crm")) {
element.src = "img/cal.png";
}
else {
element.src = "img/crm.jpg";
}
}
</script>
</head>
<body>
<img id="myimage" önclick="changeImage();">
src="img/crm.jpg" height="100" width="100"/>
<p>Click the light bulb to turn on/off the light</p>
</img></body>
</html>