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:

var index = 1;

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

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