I've got 5 images that I want to display one after the other with a time delay, e.g.
image one displayed
0.5 seconds
image two displayed
0.5 seconds
image three displayed
At the moment the HTML looks like this:
<div id="header">
<img id="headerImage0" src="">
<img id="headerImage1" src="">
<img id="headerImage2" src="">
<img id="headerImage3" src="">
<img id="headerImage4" src="">
</div>
The CSS looks like this:
div#header img
{
visibility: hidden
}
div#header img.headerImageShow
{
visibility: visible
}
The JavaScript looks like this:
function showImages(i) {
var image = document.getElementById("headerImage"+i);
image.className = "headerImageShow";
}
for(i=0;i<=4;i++)
{
var t=setTimeout("showImages(i)",1000);
}
It seems that you can't pass variables to a function within the setTimeout part of the code, so the showImages function isn't getting passed the i variable that it needs . . . I'm really stuck on how to fix this
Is "setTimeout" deprecated as well? The only articles that I can seem to find on it are about 6 years old.