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

Help adding basic javascript code to /customer/home.tpl

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-16-2007, 06:53 AM
 
AgentBristow AgentBristow is offline
 

Advanced Member
  
Join Date: Jun 2007
Posts: 36
 

Default Help adding basic javascript code to /customer/home.tpl

I am trying to add the following small piece of Javascript to /customer/home.tpl so I can have a jump menu on the page:

<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>


However it doesn't work. When I view the source code of the live page for some reason xcart keeps changing the code to:
<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore)//-->
</script>

Even if I place the code just before the </head> tag. Why does it do this? Where should or could I put this code so that xcart wont stuff it up?

Thanks!



ON EDIT: I just tried another more basic javascript and it did the same thing! Changed this:
<script type="text/javascript">
function changepage(obj) {
window.location.href = obj.value;
}
</script>

to this:
<script type="text/javascript">
function changepage(obj)
</script>
__________________
Xcart Version 4.1.9 [win]
Reply With Quote
  #2  
Old 07-16-2007, 08:00 AM
 
balinor balinor is offline
 

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

Default Re: Help adding basic javascript code to /customer/home.tpl

You need to put literal tags around any JS

{literal}

javascript here
{/literal}
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 07-16-2007, 08:05 AM
 
AgentBristow AgentBristow is offline
 

Advanced Member
  
Join Date: Jun 2007
Posts: 36
 

Default Re: Help adding basic javascript code to /customer/home.tpl

Argh! All this time it was so simple. Thanks so much for your help
__________________
Xcart Version 4.1.9 [win]
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 01:26 AM.

   

 
X-Cart forums © 2001-2020