Forum Moderators: open
I have 8 images I wish to rotate in four slots on my site.
I have set the images to preload (using Macromedia's preload script)
I also set up a timer onload to do the image rotations.
What happens when you load the page is that the images are reloaded every time the timer calls for them again. Causing an immense strain on the connection/server.
If you then use the back button to leave the page and forward button to go back on to the page it works fine and the images then swap without reloading at each call of the timer program.
Code snippets below:
function StartHome(){
setTimeout("ChangeHome()", 1000);
}
function ChangeHome(){
if (startNo > 8)
{
startNo = 1;
}
//document.images['pic1'].src=arImageList[startNo].src;
// MM_swapImage('pic1','', arImageList[startNo].src);
//MM_swapImage('pic2','', arImageList[startNo+1]);
//MM_swapImage('pic3','', arImageList[startNo+2]);
//MM_swapImage('pic4','', arImageList[startNo+3]);
MM_swapImage('pic1','', 'images/51170keepfit.jpg');
MM_swapImage('pic2','', 'images/87034column.jpg');
MM_swapImage('pic3','', 'images/87070twoback.jpg');
MM_swapImage('pic4','', 'images/87076wait.jpg');
startNo++;
setTimeout("ChangeHome()", 1000);
}
onload="MM_preloadImages('images/51133basket.jpg','images/51170keepfit.jpg',
'images/87034column.jpg','images/87070twoback.jpg','images/87076wait.jpg',
'images/87111shape.jpg','images/87123bike.jpg','images/87149plane.jpg');
StartHome();"
I need some ideas of how to get the images to load just once so that they don't overload the connection.
<I added linebreaks to the code to eliminate horizontal scrolling on the page - Tedster>
(edited by: tedster at 9:58 am (utc) on April 6, 2002)