Replace image with another
http://www.kirupa.com/forum/showthread.php?380597-Making-an-image-swapper-selector-in-HTML5-that-works-across-devices&p=2661449#post2661449
by Andreas Renberg
HTML
<img id="img1" src="http://lorempixel.com/300/300/food/Original%20image/" width=300 height=300 /><br/>
<br/>
<a id="randomize-link" href="#">Click me to replace the existing image</a>
JavaScript
var link = document.querySelector("#randomize-link");
link.addEventListener('click', randomImage);
function randomImage() {
var img1 = document.querySelector("#img1");
var newImageURL = 'http://lorempixel.com/300/300/food/' + parseInt(Math.random() * 10 + 1) + '/Random%20image';
img1.src = newImageURL;
}