Hero image with link randomizer

by freedawirl

HTML

<div id="image">
<!--   Image dynamically appears hear -->
</div>

JavaScript

var total_images = 3;
var image = document.getElementById('image');
var random_number = Math.floor((Math.random()*total_images));
var random_img = [];

random_img[0] = '<a href="https://google.com"><img src="http://placehold.it/350x150"></a>';
random_img[1] = '<a href="https://google.com"><img src="http://placehold.it/350x250"></a>';
random_img[2] = '<a href="https://google.com"><img src="http://placehold.it/350x350"></a>';

image.innerHTML = random_img[random_number];