Analysis of JavaScript for slideshow control
The JavaScript for the Controlled Slideshow is currently in the JavaScript file slides.js - It is probably better to debug this on the development page. i.e. not in a linked script file.
The main function below was taken from the example on the W3C page and it works quite well. I have attempted to make changes to it to allow the speed, next, previous and pause functions.
The main JavaScript for slide control:
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("demo");
var captionText = document.getElementById("caption");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
captionText.innerHTML = dots[slideIndex-1].alt;
slideIndex = 0;
}