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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ad rotator

Status
Not open for further replies.

hillbillyfritz

Technical User
Mar 28, 2001
34
US
I am using the following script to rotate my banner ads. When I click an ad a blank window comes up with "javascript:doLink2();" in the address bar, any suggestions? Thanks in advance.

Code:
///set image paths
src2 = ["images/ad1.jpg", "images/ad2.gif", "images/ad3.jpg", "images/ad4.gif", "images/ad5.jpg", "images/ad6.gif"]

//set corresponding urls
url2 = ["[URL unfurl="true"]http://link1.com",[/URL] "[URL unfurl="true"]http://link2.com",[/URL] "[URL unfurl="true"]http://link3.com","http://link4.com",[/URL] "[URL unfurl="true"]http://link5.com",[/URL] "[URL unfurl="true"]http://link6.com"[/URL]]


//set duration for each image
duration2 = 3;

//Please do not edit below
ads2=[]; ct2=8;
function switchAd2() {
var n2=(ct2+1)%src2.length;
if (ads2[n2] && (ads2[n2].complete || ads2[n2].complete==null))
{
document["Ad_Image2"].src = ads2[ct2=n2].src;
}
ads2[n2=(ct2+1)%src2.length] = new Image;
ads2[n2].src = src2[n2];
setTimeout("switchAd2();",duration2*1000);
}

function doLink2(){
window.open(url2[ct2]);
} onload = function(){
if (document.images)
switchAd2();
}

document.write(
'<div align=&quot;center&quot;>'
+'  <center>'
+'      <A HREF=&quot;javascript:doLink2();&quot; onMouseOver=&quot;status=url2[ct2];return true;&quot;>'
+'      <IMG NAME=&quot;Ad_Image2&quot; SRC=&quot;images/ad6.gif&quot; BORDER=0></A>'
+'  </center>'
+'</div>'
)
 
what is the onload = function() about? Klae

You're only as good as your last answer!
 
I don't really know. Someone else gave me this script, but they didn't write it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top