X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Help with putting in random image javascript (https://forum.x-cart.com/showthread.php?t=13128)

More-Japan 03-31-2005 09:44 AM

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?

balinor 03-31-2005 09:48 AM

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.

More-Japan 03-31-2005 09:59 AM

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>

shan 03-31-2005 10:05 AM

if you look in custom mods forum youll find plenty of random image mods


All times are GMT -8. The time now is 02:30 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.