I am trying to make my animation going but it seems like there is something I am missing that I couldn't figure out yet... any help will be highly appreciated.
Code:
<script type="text/JavaScript">
// Preloaded images
if (document.images)
{
demo1 = new Image();
demo1.src = "images/home/animation/image1.jpg";
demo2 = new Image();
demo2.src = "images/home/animation/image2.jpg";
demo3 = new Image();
demo3.src = "images/home/animation/image3.jpg";
}
// Reusable timer
function timeimgs(numb)
{
thetimer = setTimeout("imgturn('" +numb+ "')", 1000);
}
// Reusable image turner
function imgturn(numb)
{
if (document.images)
{
// This will loop the image
if (numb == "3")
{
document["demo"].src = eval("demo3.src");
timeimgs('1');
}
else
{
document["demo"].src = eval("demo" + numb + ".src");
timeimgs(numb = ++numb);
}
}
}
</script>
<div id="mainDisplay" onload="timeimgs('2');">
<img src="images/home/animation/image1.jpg" width="600" height="200">
</div>