Turn On or Off Bulb using JavaScript

Write a JavaScript code that turns ON and OFF the Light Bulb.

<html>
<head>
<script type="text/javascript">
function switchBtn(){
  var image = document.getElementById('light');
  var val = document.getElementById('switchButton');
  if(val.value=="ON"){
    image.src = 'ON.jpg';
    val.value = 'OFF';
  }else if(val.value=="OFF"){
    image.src = 'OFF.jpg';
    val.value = 'ON';
  }
}
</script>
</head>
<body>
<center>
<img id="light" src="OFF.jpg" width="200" height="300" /><br><br>
<form>
<input id="switchButton" type="button" value="ON" style="width: 100px;" onclick="switchBtn()" />
</form>
<center>
</body>
</html>
Test Here