Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with a banner rotating script

Status
Not open for further replies.

swizzy

Technical User
Apr 2, 2004
59
US
Does anyone know of a banner rotating script that actually works that I can copy and paste into my script in Dreamweaver.

I've tried several scripts and none of them work.

I especially have troubles with the "body onload" scripts even though I am adding it correctly in the body onload.

I was successful with the following script last year, but god knows how I did it, it just isn't working anymore :^(

<script language="JavaScript">
// Copyright 1996, Infohiway, Inc. (// Courtesy of SimplytheBest.net - <!--
function adArray() {
for (i=0; i*2<adArray.arguments.length; i++) {
this = new Object();
this.src = adArray.arguments[i*2];
this.href = adArray.arguments[i*2+1];
}
this.length = i;
}
function getAdNum() {
dat = new Date();
dat = (dat.getTime()+"").charAt(8);
if (dat.length == 1)
ad_num = dat%ads.length;
else
ad_num = 0;
return ad_num;
}
var ads = new adArray(
"images/banner_1.gif",""images/banner_2.gif",""images/banner_3.gif","var ad_num = getAdNum();
document.write('<CENTER><TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0><TR><TD '
+'ALIGN=CENTER><FONT SIZE=2 FACE=Arial><B>SimplytheBest DHTML Scripts & JavaScripts is sponsored by: '
+'</FONT></TD><TR></TR><TD><A HREF="'+ads[ad_num].href+'"><IMG SRC="'+ads[ad_num].src+'" '
+'WIDTH="468" HEIGHT="60" BORDER=0 name=js_ad></A></TD></TR></TABLE></CENTER>');
link_num = document.links.length-1;
function rotateSponsor() {
if (document.images) {
ad_num = (ad_num+1)%ads.length;
document.js_ad.src = ads[ad_num].src;
document.links[link_num].href = ads[ad_num].href;
setTimeout("rotateSponsor()",5000);
}
}
setTimeout("rotateSponsor()",5000);
// -->
</script>

Also, does it matter if my banner is gif or jpg? And does the script only work if it is actually online? Why doesn't rotate work in Dreamweaver after you F12 and preview?

Is it best to add the script *within* the website where you want it to appear, or outside the layout table at the bottom?

Please advise, I am at my wit's end!


Any help would be greatly appreciated!

Miss Swizzy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top