// stien til en mappe hvor billederne ligger i. var url = "http://gudenaasammenslutningen.dk/billeder/statbilleder"; var pictureArray = new Array(); pictureArray[0] = "10231.jpg"; pictureArray[1] = "10222.jpeg"; pictureArray[2] = "10223.jpg"; pictureArray[3] = "10224.jpg"; pictureArray[4] = "10226.jpg"; pictureArray[5] = "10227.jpg"; pictureArray[6] = "10228.jpg"; pictureArray[7] = "10232.jpg"; pictureArray[8] = "10245.jpg"; pictureArray[9] = "10252.jpg"; pictureArray[10] = "10264.jpg"; pictureArray[11] = "10269.jpg"; pictureArray[12] = "10272.jpg"; 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; } }