This is a good script to use for placing a random ad on a page. Once the page is loaded, a random image will be selected and placed on the page. If the image is clicked, the visitor will be brought to the website that corresponds to the image.
Copy the following script and paste it where you would like the image to appear:
<script language="Javascript">
function randomads() {
var ads=new Array()
ads[0]="image1.gif"
ads[1]="image2.gif"
ads[2]="image3.gif"
var adlinks=new Array()
adlinks[0]="http://www.link1.com"
adlinks[1]="http://www.link2.com"
adlinks[2]="http://www.link3.com"
num=Math.floor(Math.random()*ads.length)
document.write('<a href='+'"'+adlinks[num]+'"'+' target=_blank>
<img src="'+ads[num]+'" border=0></a>')
} </script>
Just make sure to change the names of the images and the links. So if your image is saved as jacorre.gif and the website is www.jacorre.com then you would type the following:
ads[0]="jacorre.gif"
adlinks[0]="http://www.jacorre.com"
If you need more images/links, just add an entry to each array like so:
var ads=new Array()
ads[0]="image1.gif"
ads[1]="image2.gif"
ads[2]="image3.gif"
ads[3]="image4.gif" (4th image added)
ads[4]="image5.gif" (5th image added)
var adlinks=new Array()
adlinks[0]="http://www.link1.com"
adlinks[1]="http://www.link2.com"
adlinks[2]="http://www.link3.com"
adlinks[3]="http://www.link4.com" (4th link added)
adlinks[4]="http://www.link5.com" (5th link added)
discuss this topic to forum
