Q:

Very simple Javascript ad placement engine

I have ten different banner ads uploaded on my site. I want to make a Javascript program that will randomly show one each time a page is loaded. How would I do this?

A:

you save the urls to an array and then pick an index with a random function between 0-9 and your done
function:
var rand_no = Math.ceil(10*Math.random())

array
var image=new Array(); 
image[0]="image.jpg";       
image[1]="image.jpg";
image[2]="image.jpg";

etc
alert(image[rand_no]);

