I
Ian Hubling
I'm trying to complete a rotating banner ad within a page I have. The
rotating add has four images that rotate in three-second increments.
I've got the images to rotate ok - but now I want to go one step
further and can't figure out how to do it...
I want to have it so that when the person clicks on the specific ad,
they are taken to a URL that is unique to each ad.
I presume I would have to surround the img tag with an href tag, but
how would I reference the array to get the correct URL?? HELP.
Here is the code I'm using. Any help would be appreciated.
I've omitted unnecessary parts of the page.
-----------------------------------------------
<head>
<script>
var myPix, imCt, thisAd;
myPix=new Array("images/banner01.jpg", "images/banner02.jpg",
"images/banner03.jpg", "images/banner04.jpg");
imgCt=myPix.length;
var thisAd=0;
function rotate()
{
thisAd++
if(thisAd==imgCt)
{
thisAd=0;
}
document.adBanner.src=myPix[thisAd];
setTimeout("rotate()",3*1000);
}
</script>
</head>
<body onLoad="rotate();">
<div align="center">
<img src="images/banner01.jpg" name="adBanner"/></div>
</body>
rotating add has four images that rotate in three-second increments.
I've got the images to rotate ok - but now I want to go one step
further and can't figure out how to do it...
I want to have it so that when the person clicks on the specific ad,
they are taken to a URL that is unique to each ad.
I presume I would have to surround the img tag with an href tag, but
how would I reference the array to get the correct URL?? HELP.
Here is the code I'm using. Any help would be appreciated.
I've omitted unnecessary parts of the page.
-----------------------------------------------
<head>
<script>
var myPix, imCt, thisAd;
myPix=new Array("images/banner01.jpg", "images/banner02.jpg",
"images/banner03.jpg", "images/banner04.jpg");
imgCt=myPix.length;
var thisAd=0;
function rotate()
{
thisAd++
if(thisAd==imgCt)
{
thisAd=0;
}
document.adBanner.src=myPix[thisAd];
setTimeout("rotate()",3*1000);
}
</script>
</head>
<body onLoad="rotate();">
<div align="center">
<img src="images/banner01.jpg" name="adBanner"/></div>
</body>