•
•
•
•
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
![]() |
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
W. C. Fields
•
•
Join Date: Sep 2005
Location: St. Louis
Posts: 145
Reputation:
Rep Power: 4
Solved Threads: 0
Being a newb to JavaScript, here is what I have for the banner ad rotation:
and
The above has the ads rotating properly. What can I plug in to get each ad hooked up to it's own link?
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> 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
W. C. Fields
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Cheap Banner Ads For Sale (Ad Space for Sale)
- I buy text links PR 1+... (Ad Space for Sale)
- WeLoveCSS Forum - Text Links & 4 banner spots available! PR 5 (Ad Space for Sale)
- Link exchange and advertising !! (Ad Space for Sale)
- g2g FREE Ad Forum, Link/Banner Exchange Service! (Ad Space for Sale)
- Advertising Spaces available [LIMITED TIME OFFER] Grab it as soon as possible !! (Ad Space for Sale)
- When a host says "included scripts" (Networking Hardware Configuration)
- Advertising spots available on our Paid-To-Post forum (Ad Space for Sale)
- Links and Banner advertisement available on Gaming site (Ad Space for Sale)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: creation of checkbox in javascript
- Next Thread: Help with making decimals show up always


Linear Mode