// JavaScript to interpolate random images into a page. // Steps to add new image // =========== // 1. change the number of images // =========== var ic = 6; // Number of alternative images //== no need to change var pic1 = new Array(ic); // Array to hold filenames picurl = "/docs/IO/4762/"; // Picture URL, in this case, it is the same as the support file location // ============ // 2. copy the following line: // pic1[#] = "header_01.jpg"; // and then paste it at the bottom of the image list. Remember to change # to the correct number // ============ pic1[0] = "header_01.jpg"; pic1[1] = "header_03.jpg"; pic1[2] = "header_04.jpg"; pic1[3] = "header_05.jpg"; pic1[4] = "header_06.jpg"; pic1[5] = "header_07.jpg"; function pickRandom(range) { if (Math.random) return Math.round(Math.random() * (range-1)); else { var now = new Date(); return (now.getTime() / 1000) % range; } } // Write out an IMG tag, using a randomly-chosen image name. var choice1 = pickRandom(ic); document.writeln('');