// stien til en mappe hvor billederne ligger i. var url = "http://gudenaasammenslutningen.dk/billeder/statbilleder"; var pictureArray = new Array(); var imagePreloader = new Array(); function randomPicture(interval,amount) { for (i = 1; i<=pictureArray.length; i++) { var image = new Image(); image.src = url + "/"+ pictureArray[i-1]; imagePreloader[i-1] = image; } var layout = ""; for (j = 0; j < amount; j++) { var rnd = Math.round(Math.random() * (imagePreloader.length -1)); var imgSrc = imagePreloader[rnd].src; layout += ""; } layout = '' + layout +'
'; document.write (layout); setInterval ("updateImage("+ amount +")", interval); } function updateImage(amount) { for (i = 0; i < amount; i++ ) { var rnd = Math.round(Math.random() * (imagePreloader.length -1)); var imgSrc = imagePreloader[rnd].src; document.getElementById('random_image'+i).src = imgSrc; } }