Darrius Rankin Darrius Rankin - 1 year ago 120
HTML Question

Images won't show in slide show

The first image will appear but then the rest won't. I don't think the script can locate them. How do I direct it to my images?

// JavaScript Document

var myImgage=document.getElementById("slideshow");

var imageArray=["healing.jpg","holiday.jpg","nye.jpg","basketball.jpg"]

var imageIndex=0;

function changeImage () {
slideshow.setAttribute("src", imageArray [imageIndex]);
if (imageIndex>=imageArray.length) {

var intervalHandle = setInterval(changeImage,2000);
slideshow.onclick=function () {

// Html

<img id="slideshow" src="image/healing.jpg" width="80%" height="40%"/>
<script src="java/slideshow.js"></script>

Answer Source

Try changing your imageArray to the following

var imageArray=["image/healing.jpg","image/holiday.jpg","image/nye.jpg","image/basketball.jpg"]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download