1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26: |
rotator=true; // needed for initialising the rotator
n=0; // initialising the first image
// The images, add and delete yours here...
theImages="0.gif, 1.gif, 2.gif, 3.gif, 4.gif, 5.gif, 6.gif, 7.gif, 8.gif, 9.gif".split(", ");
allImages=theImages.length;
// Creating the needed image objects => preloading
imgObjects=new Array();
for (i in theImages){
imgObjects[i]=new Image();
imgObjects[i].src=theImages[i];
}
function autoplay(run,srcimage,direction,speed){
// delete old settings
clearInterval(rotator)
if (run != 0){rotator=setInterval("rotate('"+srcimage+"',"+direction+")",speed)}
else{clearInterval(rotator)}
}
function rotate(srcimage,direction){
n=n+direction;
if (n==allImages) n=0;
if (n==-1) n=allImages-1;
document.images[srcimage].src=imgObjects[n].src;
} |