How do I change this script?

Hi All

I have this script on my home page, but the images rotate randomly as stated below, how do I make them rotate in list order? I have tried looking it up on the net but no answers.

<SCRIPT LANGUAGE=“Javascript”>

function image() {
};

image = new image();
number = 0;

// imageArray
image[number++] = “<img src=‘img/.gif’ border=‘0’>”

// keep adding items here…

increment = Math.floor(Math.random() * number);

document.write(image[increment]);

//</SCRIPT>

Thanks in advance

Instead of using Math.random just build a loop that runs through them one by one:

for (x = 0; x < image.length; x++) {
document.write(image);
}

thanks for your answer, I dont understand java scipt at all, I thought I would of had to change the ‘random’ word to something else. Obviously not - what do I do with that that you posted.

The simplest solution is to add 1 to the increment, then force it back to 0 when it get to the length of the images array.


increment = (increment + 1) &#37; number;

I put:

increment = (increment + 1) % number;

in the place of

increment = Math.floor(Math.random() * number);

and it has done nothing.

I did say I know nothing about javascript - I am seeking the answer to how I can make my image NOT rotate randomly, and rotate in the order they are listed in.

I dont understand Javascript - I dont know what forcing something is or looping something else (You might as well be talking Japanese).

From what I can tell so far, this is the line thats providing the random images - increment = Math.floor(Math.random() * number);

What do I put in this line so the images rotate in the order listed?

Thanks in advance