Forum Moderators: open
How do I ammend the following banner rotation code so that the links open in a new window please? Thank you very much :)
<SCRIPT language=JAVASCRIPT type=TEXT/JAVASCRIPT>
<!-- Hide script from old browsers
adImages = new Array("http://www.qksrv.net/image-734283-1205205","/bla/ban/blabanukalig.gif","/whs/cdp/ban/cdpbanlikemusic.gif")
adURL = new Array("http://www.qksrv.net/click-734283-1205205","http://www.UKHotMovies.com/shopping","http://WHSmithMusic.cjb.net")
thisAd = 0
imgCt = adImages.length
function rotate() {
if (document.images) {
if (document.adBanner.complete) {
thisAd++
if (thisAd == imgCt) {
thisAd = 0
}
document.adBanner.src=adImages[thisAd]
}
setTimeout("rotate()", 17 * 1000)
}
}
function newLocation() {
document.location.href = "" + adURL[thisAd]
}
// End hiding script from old browsers -->
</SCRIPT>
<A href="javascript:newLocation()"><IMG
src="/bla/ban/blabanukwholepic.jpg"
name=adBanner></A></div>
function newLocation() {Instead of just resetting document.location.href, the function needs to open a new window for the URL, something like this:
document.location.href = "" + adURL[thisAd]
}
function newLocation() {I'm not quite sure what those double quotes with no content are all about in the original code. Hope this gives you a place to start testing something new, anyway.
window.open(adURL[thisAd],window2)
}
Maybe this is simply a remnant of a different script that was modified for this purpose. But it sure won't hurt anything to leave that pair of double quotes in there, just to be sure.
Speaking of double quotes, I believe I forgot a pair of them -- the name of the new window, "window2", needs them. So now the code might look like this:
function newLocation() {
window.open(""+adURL[thisAd],"window2")
}