View Single Post
  #1  
Old 07-04-2004, 09:58 AM
 
mlannen@tecconvt.net mlannen@tecconvt.net is offline
 

Member
  
Join Date: Jun 2004
Posts: 14
 

Default Random Top Logo Banner

Hi All,

This is my current X-Cart
http://216.204.82.125/nutriteam/xcart/customer/home.php

I would like to make the top banner Image rotate on refresh or when you goto a different category.

I found some javascript online, but I am not sure how to implement it into head.tpl. Any help woudl be greatly appreciated. Thanks!!

Here is the random image script i found:

This is supposed to be put in the <head> of a normal html file:

<script>
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
function create() {
this.width = ''
this.height = ''
this.src = ''
this.border = ''
}
ads = new Array()
for(var i=1; i<=5; i++) { ads[i] = new create() }

ads[1].width = "281"
ads[1].height = "59"
ads[1].src = "images/quote001.gif"
ads[1].border = "0"
ads[1].mouseover = "Click to Refresh"

ads[2].width = "257"
ads[2].height = "52"
ads[2].src = "images/quote002.gif"
ads[2].border = "0"

ads[3].width = "257"
ads[3].height = "52"
ads[3].src = "images/quote003.gif"
ads[3].border = "0"

ads[4].width = "257"
ads[4].height = "52"
ads[4].src = "images/quote004.gif"
ads[4].border = "0"

ads[5].width = "257"
ads[5].height = "52"
ads[5].src = "images/quote002.gif"
ads[5].border = "0"

var n = Math.random() + ''
n = parseInt(n.charAt(5))
if(n >5) {
n = n - 5
}
else if(n==0) {
n = n + 5
}
n += ""

var image = ads[n]
var ad = ""
ad += '[img]' + image.src + '[/img]


And then this is supposed to be put in the body:

script language="JavaScript">
<!-- hiding this script
document.write(ad)
// -->
</script>
Reply With Quote