powerful_rogue
05-23-2009, 09:33 AM
Hi,
Im playing with the following code, but for some reason cant seem to get the "push" function to operate.
This is my code below
<title>Image Array</title>
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
adImages = new Array("images/banner/dods.gif","images/banner/dovermemorial1.gif","images/banner/doverlocals.gif","images/banner/DoverLifeboatBanner.gif")
adURL = new Array("dods.com", "dover.gov.uk","doverlocals.co.uk","lifeboat.org.uk")
thisAd = 0
imgCt = adImages.length
function rotate() {
if (document.images) {
thisAd++
if (thisAd == imgCt) {
thisAd = 0
}
document.adBanner.src=adImages[thisAd]
setTimeout("rotate()" , imgCt * 1000)
}
}
function newLocation() {
document.location.href = "http://www." + adURL[thisAd]
}
adImages.push("images/banner/freecycle.jpg")
adURL.push("freecycle.org")
</script>
</head>
<BODY BGCOLOUR=BLUE onLoad="rotate()">
<center>
<A HREF="javascript:newLocation()">
<IMG SRC="images/banner/dods.gif" WIDTH=468 HEIGHT=60 NAME="adBanner" BORDER="0"></A>
</center>
</body>
</html>
I want to be able to add a banner onto the end of adImages and a webaddress onto the end of adURL
The current arrays work fine, however I cant seem to get the new ones in the push command to be added!
Any help greatly appreciated!
Im playing with the following code, but for some reason cant seem to get the "push" function to operate.
This is my code below
<title>Image Array</title>
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
adImages = new Array("images/banner/dods.gif","images/banner/dovermemorial1.gif","images/banner/doverlocals.gif","images/banner/DoverLifeboatBanner.gif")
adURL = new Array("dods.com", "dover.gov.uk","doverlocals.co.uk","lifeboat.org.uk")
thisAd = 0
imgCt = adImages.length
function rotate() {
if (document.images) {
thisAd++
if (thisAd == imgCt) {
thisAd = 0
}
document.adBanner.src=adImages[thisAd]
setTimeout("rotate()" , imgCt * 1000)
}
}
function newLocation() {
document.location.href = "http://www." + adURL[thisAd]
}
adImages.push("images/banner/freecycle.jpg")
adURL.push("freecycle.org")
</script>
</head>
<BODY BGCOLOUR=BLUE onLoad="rotate()">
<center>
<A HREF="javascript:newLocation()">
<IMG SRC="images/banner/dods.gif" WIDTH=468 HEIGHT=60 NAME="adBanner" BORDER="0"></A>
</center>
</body>
</html>
I want to be able to add a banner onto the end of adImages and a webaddress onto the end of adURL
The current arrays work fine, however I cant seem to get the new ones in the push command to be added!
Any help greatly appreciated!