User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 456,234 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,745 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 2450 | Replies: 3 | Solved
Reply
Join Date: Sep 2005
Location: St. Louis
Posts: 145
Reputation: kahaj is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
kahaj kahaj is offline Offline
Junior Poster

Links to Rotating Banner Ad

  #1  
Nov 14th, 2007
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....
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2005
Posts: 236
Reputation: Inny is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 6
Inny's Avatar
Inny Inny is offline Offline
Posting Whiz in Training

Re: Links to Rotating Banner Ad

  #2  
Nov 14th, 2007
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>
Always carry a flagon of whiskey in case of snakebite and furthermore always carry a small snake.
W. C. Fields
Reply With Quote  
Join Date: Sep 2005
Location: St. Louis
Posts: 145
Reputation: kahaj is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
kahaj kahaj is offline Offline
Junior Poster

Re: Links to Rotating Banner Ad

  #3  
Nov 15th, 2007
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?
Reply With Quote  
Join Date: Oct 2005
Posts: 236
Reputation: Inny is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 6
Inny's Avatar
Inny Inny is offline Offline
Posting Whiz in Training

Re: Links to Rotating Banner Ad

  #4  
Nov 15th, 2007
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>
Last edited by Inny : Nov 15th, 2007 at 1:51 am.
Always carry a flagon of whiskey in case of snakebite and furthermore always carry a small snake.
W. C. Fields
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 5:07 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC