Forum Moderators: open
As you notice, I tried target="_blank" in the HTML, but that did not work. Can someone please point me towards the right answer.
This would be exceptional, but to go above and beyond, I would like to assign blank or same windows to each banner. Some will link to the site, and some will link externally.
window.onload = initBannerLink;
var adImages = new Array("example.com/images/banner_1.jpg","example.com/images/banner_1.jpg");
var adURL = new Array("example.com/1.htm","example.com/2.htm");
var thisAd = 0;
function rotate() {
thisAd++;
if (thisAd == adImages.length) {
thisAd = 0;
}
document.getElementById("adBanner").src = adImages[thisAd];
setTimeout("rotate()", 2 * 4500);
}
function newLocation() {
document.location.href = "http://www." + adURL[thisAd];
return false;
}
function initBannerLink() {
if (document.getElementById("adBanner").parentNode.tagName == "A") {
document.getElementById("adBanner").parentNode.onclick = newLocation;
}
rotate();
}
</script>
{/literal} <a href="http://example.com/1.htm" target="_blank"><img src="http://example.com/images/banner_1.jpg" width="160" height="600" id="adBanner" border="0" alt="ad banner" /></a>