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

Help with putting in random image javascript

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-31-2005, 09:44 AM
  More-Japan's Avatar 
More-Japan More-Japan is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 107
 

Default Help with putting in random image javascript

I put this in meta.tpl simply because I don't know exactly which file has the <head> tags

This is supposed to go within the <head>

<script type="text/javascript">
<!-- Hide
pics=new Array("http://www.more-japan.com/images/top_kazama.jpg","http://www.more-japan.com/images/top_signal.jpg","http://www.more-japan.com/images/top_ueo.jpg","http://www.more-japan.com/images/top_nagisa.jpg","http://www.more-japan.com/top_sard.jpg");
lnpics=pics.length-1;
index=Math.round(Math.random()*lnpics);
// End Hiding -->
</script>


and then in head.tpl...... I call the javascript

<TABLE align=center border=0 cellPadding=0 cellSpacing=0 width="100%" height="100%">
<TR>
<TD valign=top>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
<tr>
<td>http://www.more-japan.com/images/webhead_logo.gif<script type="text/javascript">
<!-- Hide
document.write("[img]+pics[index]+[/img]" width=540 height=85 border="0" align=right usemap="#map_emaillink");
// End Hiding -->
</script>
<tr>
<td height="10"><table width="100%" height="10" border="0" cellpadding="0" cellspacing="0" background="http://www.more-japan.com/images/xcart/button_topline.gif">

etc.etc.....

but for some reason it is not showing up.... what am I doing wrong?
__________________
Version 5.2.13

http://www.more-japan.com/
Reply With Quote
  #2  
Old 03-31-2005, 09:48 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Put {literal} tags around the script, like this:

{literal}script goes here{/literal}

Also, don't call your images with hard links, or it will break your secure setting if you are using SSL.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 03-31-2005, 09:59 AM
  More-Japan's Avatar 
More-Japan More-Japan is offline
 

Senior Member
  
Join Date: Jan 2005
Posts: 107
 

Default

please disregard :doh:


I just realized what i was doing wrong and it was an input error

here is the correct code if anyone wants to use this simple random image script


<script type="text/javascript">
<!-- Hide
document.write("[img]+pics[index]+[/img]");
// End Hiding -->
</script>
__________________
Version 5.2.13

http://www.more-japan.com/
Reply With Quote
  #4  
Old 03-31-2005, 10:05 AM
  shan's Avatar 
shan shan is offline
 

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

Default

if you look in custom mods forum youll find plenty of random image mods
__________________
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 07:37 AM.

   

 
X-Cart forums © 2001-2020