reset image tag js

HTML
<img id="myImg" src="compman.gif" width="107" height="98">

<button onclick="myFunction()">Try it</button>

<script>
  
function myFunction() {
  document.getElementById("myImg").src = "hackanm.gif";
}
</script>
Source

Also in HTML: