/* This would go through pictures store in bodycontentSpace.html Pictures lasted for 3 seconds, before moving to another one in the list. */ var myIndex = 0; //starting index loopThroughPictures(); //calling funtion //creating a function function loopThroughPictures() { var i; //declaring variable var x = document.getElementsByClassName("mySlides"); //calling id tag from homepage for (i = 0; i < x.length; i++) //looping through pictures { x[i].style.display = "none"; //assigning } myIndex++; //incrementing my index if (myIndex > x.length) //checking condition { myIndex = 1; //assigning variable } x[myIndex-1].style.display = "block"; //assigning variable setTimeout(loopThroughPictures, 3000); // Change image every 3 seconds }