>>> this example in Swedish
Two pictures - one red and one white - shown at different places.
Images and text are put in different columns (TD) in
a table (TABLE). You could also use a stylesheet.
Put the script within SCRIPT tags in the HEAD portion of the
document (see MINIMANUAL 1 basics):
i = 0 //2
j = 0
iljcalled = 0 //3
bild = new Array()
bild= new Image()
bild= new Image()
bild.src= "picture file (here:the red circle)"
bild.src= "picture file"
if(iljcalled == 0) //5
iljcalled = 1 //7
document.images[i].src = bild.src //8
document.images[i-4].src = bild.src //10
iljtimer = setTimeout("iljanim()",250) //11
1 if the browser is capable of switching images the code within curly brackets will be executed, i e some variables will be defined and the images will be loaded
2 i is used to keep track of where to show the picture
3 iljcalled is used to make sure that that the animation is started only once (if you were to use a link to start it)
4 this line checks if itīs OK to switch images; if thatīs so and...
5 if the function hasnīt been called yet then...
6 iljanim() is called and...
7 iljcalled takes the value of 1, making further calling of the function impossible
8 the first image you put on a page using the IMG tag is document.images, the second document.images etc. This line, then, shows the red circle first at the place document.images, then at document.imagesetc. i is increased by 1 each time the function iljanim() is called
9 when i is greater than 3 and thus four round circles are seen then...
10 the last red circle is replaced by the white, invisible picture
11 this is where the function iljanim() calls itself every 250/1000 seconds
12 i is increased by 1
13 when i equals 27 (a number that of course has to be adjusted according to the number of pictures you use and the time you want to elapse before restarting) then...
14 i takes the value of 0 and everything starts all over again
15 when j equals 5, i e after 5 "restarts", then...
16 the timer is stopped
If you want the animation to start as soon as the page has loaded you can put the starting call after BODY ONLOAD, like this
Last modified: January 15, 1998
This page should be part of a frames system