Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Random Top Logo Banner

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #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
  #2  
Old 07-04-2004, 09:27 PM
 
anandat anandat is offline
 

X-Adept
  
Join Date: Jan 2004
Posts: 914
 

Default

Hello mlannen,
You need to put your java script under {literal} tag.
For example
{literal}<script> your script code here</script>{/literal}

I hope this help.
regards,
Anand
__________________
X-Cart: 4.7.7 LIVE
Skin:Ultra by xcartmods.co.uk
X-cart Modules: | ACR, Rich Google Search, Customer Testimonials | Cloud Search, | Websitecm: CDSEO (2.1.9)
---------------
Server: Linux
php: 5.3
mysql: 5.0.89
----------------
Reply With Quote
  #3  
Old 07-05-2004, 07:36 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

youll find a few random image scripts in the custom mods forum
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:45 PM.

   

 
X-Cart forums © 2001-2020