js set image code example
Example 1: javascript change image src
//change image src
document.getElementById('myImageID').src="images/my_other_image.png";
Example 2: how to set diferent images in html through js
<div id="x"></div>
<script>
var img = document.createElement("img");
img.src = "image.png";
var src = document.getElementById("x");
src.appendChild(img);
</script>