Hey, I have just started scripting JavaScript and I got stuck when I wanted to change everytime the page is reloaded to have a new image.

Here is my current script:

Code:
var index = 1;

function randomContent() {
	var mainContent = document.getElementById("mainContent");
	var randomImg="images/content" + index++ + ".png";
	mainContent.src=randomImg;
}

window.onload = function() {
	// Load Random Images
	randomContent();
}
It displays the first image. However, it doesn't change every-time to a new one.