Javascript - Get image source and replace the source of another image

Details To get the source of an image, you could use the "onclick" event:


<img onclick="setImg(this.src);" src="/example.jpg" />



This will call the function "setImg" and give it the source of this object: "example.jpg"
Now, to overwrite the source of another image with the source of this image, you could use the following function for "setImg":



	<script type="text/javascript">

	    function setImg(a){

	          document.getElementById('ImageFrame').src =  a

	     }

	</script>


You need a image somewhere in your html code with the id "ImageFrame".

    Last Changes

    1. More changes, added a lot of new Terraristic photos, drastically improved contact form [22.05.2017]
    2. Overall adjustments: Archive added for "Terraristic", removed "Blog" and "Programs" (since outdated) [14.05.2017]
    3. Added "Watercreature Details" to Creatures: Creatures [01.03.2017]
    4. Added "Thunder Bug Life Cycle" to Creatures: Creatures [23.02.2017]
    5. Added "Xanothl " to Creatures: Creatures [12.02.2017]

     For older changes, have a look at the website's history