Troubles with Manual Slideshow

I am starting a new web page and I want to do a manual slideshow. The pictures don’t collapse together till a button is pressed. Any help would be greatly appreciated.

var slideIndex = 1; showDivs(slideIndex); function plusDivs(n) { showDivs(slideIndex += n); } function showDivs(n) { var i; var x = document.getElementsByClassName("mySlides"); if (n > x.length) { slideIndex = 1 } if (n < 1) { slideIndex = x.length }; for (i = 0; i < x.length; i++) { x[i].style.display = "none"; } x[slideIndex - 1].style.display = "block"; }