I'm having trouble with my pictures not loading even though they're in the same folder.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Animal</title>
<script type="text/javascript">
var i = 0;
var timeout;
function preLoadImages()
{
if(document.images)
{
animalArray = new Array();
animalArray[0] = new Image();
anmialArray[0] = "bear.jpg";
animalArray[1] = new Image();
anmialArray[1] = "duck.jpg";
animalArray[2] = new Image();
anmialArray[2] = "elephant.jpg";
animalArray[3] = new Image();
anmialArray[3] = "lion.jpg";
animalArray[4] = new Image();
animalArray[4] = "cat.jpg";
}
else
alert("There are no images to load");
}
function startSlideShow()
{
if(i < animalArray.length)
{
document.images["animal_pic"].src = animalArray[i];
i++;
}
else
{
i =0;
document.images["animal_pic"].src = animalArray[i];
}
timeout = setTimeout('startSlideSHow()', 3000);
}
function stopSlideShow()
{
clearTimeout(timeout);
}
</script>
</head>
<body bgcolor="#FFFF00" onLoad = "preLoadImages()">
<img name="animal_pic" height="300" width="300"/>
<form>
<br/><br/>
<input type=button value="Start Show" onClick="return startSlideShow();"/>
<input type=button value="Stop Show" onClick="return stopSlideShow();"/></form>
</body>
</html>