I am trying to implement simple image rotation in JavaScript. With a 500 ms delay, it works as I expect in IE but in Firefox, only the last image in the sequence is displayed in the browser. Firebug shows the Http load status as "Aborted" on all but the last image in the sequence. If I increase the delay to 2000 ms, it seems to work in Firefox but nothing less than that.
How do I get around this issue in Firefox regardless of the delay used to rotate the images?
Here's my code:
var camera = new Object;
camera.dir = "./images/";
camera.images=["102.jpg","102-2.jpg","102-3.jpg","102-4.jpg","102-5.jpg"];
var imageCounter = 0;
var timerRotator;
window.onload = function()
{
initialize();
};
function initialize()
{
RotateImages();
}
function RotateImages()
{
if (imageCounter >= camera.images.length)
{
return;
}
document.imgCamera.src = camera.dir + camera.images[imageCounter];
imageCounter++;
timerRotator = setTimeout("RotateImages()",500);
}
Usually when errors crop up like this in Firefox, it's me doing something incorrectly.