So,I'm very new to javascript, I realise that there are similar questions out there but I can't see how to make them work with the script I found and I'm trying to learn from.
The script below seems simple and works well but I'd lie to know how to add the code to make the images display in random order.
Please help....
<script>
var i = 0; // Start point
var images = [];
var time = 5000;
// Image List
images[0] = 'images/image1.jpg';
images[1] = 'images/image2.jpg';
images[2] = 'images/image3.jpg';
images[3] = 'images/image4.jpg';
// Change Image
function changeImg(){
document.slide.src = images[i];
if(i < images.length - 1){
i++;
} else {
i = 0;
}
setTimeout("changeImg()", time);
}
window.onload = changeImg;
</script>