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 adding basic javascript code to /customer/home.tpl (https://forum.x-cart.com/showthread.php?t=32584)

AgentBristow 07-16-2007 06:53 AM

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>

balinor 07-16-2007 08:00 AM

Re: Help adding basic javascript code to /customer/home.tpl
 
You need to put literal tags around any JS

{literal}

javascript here
{/literal}

AgentBristow 07-16-2007 08:05 AM

Re: Help adding basic javascript code to /customer/home.tpl
 
Argh! All this time it was so simple. Thanks so much for your help :)


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

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