Where do you put the links when you have 5 different banner ads that rotate on a fixed amount of time? It's obviously not around the <img> tag in the body, because that links all five banners to that one single URL....

Recommended Answers

All 3 Replies

try this mate. replacing images and links with your own.

<center><script language="JavaScript">
<!--
// Create arrays to contain all the values 
// for links and image locations
link = new Array
image = new Array

link[1]="http://www.wildexpo.com.au/Aust%20Rep%20Show/"
image[1]="http://www.reptilesaustralia.com.au/forums/Ads/wildexpo.gif"

link[2]="http://www.freewebs.com/langylot/"
image[2]="http://i14.photobucket.com/albums/a345/Instar/reptilemad.jpg"

link[3]="http://www.theherphouse.com/"
image[3]="http://www.theherphouse.com/mkportal/templates/default/images/logo.jpg"

link[4]="http://www.aftcra.org.au/"
image[4]="http://i14.photobucket.com/albums/a345/Instar/adimage2.jpg"

link[5]="http://reptilesaustralia.com.au/index.html"
image[5]="http://i14.photobucket.com/albums/a345/Instar/reptilesaustralia.jpg"

link[6]="http://www.zoomed.com/"
image[6]="http://www.reptilesaustralia.com.au/forums/Ads/zoomed.jpg"

link[7]="http://www.reptilepark.com.au/"
image[7]="http://i14.photobucket.com/albums/a345/Instar/arpbanner468x60.jpg"

link[8]="http://www.wildlifewarriors.org.au/"
image[8]="http://i14.photobucket.com/albums/a345/Instar/www_banner.jpg"

link[9]="http://saveourreptiles.proboards50.com/index.cgi"
image[9]="http://i50.photobucket.com/albums/f335/lnvexotics/Untitled-1undoner11.jpg"

// Create a random number between 1 and last number
random_num = (Math.round((Math.random()*8)+1))
// Write a link and images with random array
document.write('<a href="' + link[random_num] + '" target="_blank">'); 
document.write('<img src="' + image[random_num] + '" border="0"></a>'); 
-->
</script>
</center>

Being a newb to JavaScript, here is what I have for the banner ad rotation:

setInterval('ads()', 2500);
var i = 1;
var adArray = new Array();
adArray[0] = 'bannerCowboysDotCom.jpg';
adArray[1] = 'bannerNFLDotCom.jpg';
adArray[2] = 'bannerNFLPlayers.jpg';
adArray[3] = 'bannerProBowl.jpg';
adArray[4] = 'bannerSuperBowl.jpg';

and

<div align="left"><img id="ads" src="bannerCowboysDotCom.jpg" /></div>

The above has the ads rotating properly. What can I plug in to get each ad hooked up to it's own link?

The code above will do that. what dont you understand? just use complete urls to both images and links.

<center><script language="JavaScript">
<!--
// Create arrays to contain all the values 
// for links and image locations
link = new Array
image = new Array

link[1]="YOUR LINK TO COWBOYS"
image[1]="/bannerCowboysDotCom.jpg"

link[2]="YOUR LINK TO NFL.com"
image[2]="/bannerNFLDotCom.jpg"

link[3]="YOUR LINK TO PLAYERS"
image[3]="/bannerNFLPlayers.jpg"

link[4]="YOUR LINK TO PROBOWL"
image[4]="/bannerProBowl.jpg"

link[5]="YOUR LINK TO SUPERBOWL"
image[5]="/bannerSuperBowl.jpg"

// Create a random number between 1 and last number
random_num = (Math.round((Math.random()*4)+1))
// Write a link and images with random array
document.write('<a href="' + link[random_num] + '" target="_blank">'); 
document.write('<img src="' + image[random_num] + '" border="0"></a>'); 
-->
</script>
</center>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.