﻿var imgCount = 8;
var imgExt = '.jpg';

function setRandomImage(target, imgPath) {
    var img = document.getElementById(target);
    if (!img) return;
    img.style.backgroundImage = 'url(' + imgPath + Math.floor(Math.random() * imgCount + 1) + imgExt + ')';
}

// aggiungere al body:
// <body onload="setRandomImage('imgRandom');">
