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)
-   -   Using external Javascipts (https://forum.x-cart.com/showthread.php?t=21875)

shipmerchant 05-17-2006 06:38 PM

Using external Javascipts
 
Hi,

I need to use some external java script, I have created a /Scripts folder in my stores directory.
Created my external script and placed it in area outlined below.


Named it newscipt.js then uploaded to my newly created /scripts folder.

Then in my stores home.tpl I placed the following script to call the external java script like so:
{literal}<script language="Javascript"src="/scripts/newscript.js"type="text/javascript"></script>{/literal}

I know that any Java Scripts added to a template should be enclosed in {literal} and {/literal} but not sure where exactly to place it.
I have tried:

{literal}<script language="Javascript"src="/scripts/newscript.js"type="text/javascript"></script>
{/literal}

And even added it to the external script to no avail in both cases, like so.
{literal}<!--document.write("<script language="PlacedJavaScriptHere ")
//-->{/literal}

And tried this too:
<!--document.write({literal}"<script language="PlacedJavaScriptHere "{/literal})
//-->


Any help would be appreciated on this from you code experts.
Thanks in advance :D

Zaja 05-18-2006 12:56 AM

- Create scripts directory under skin directory.
- Call the external java script like this:
Code:

<script type="text/javascript" language="JavaScript 1.2" src="{$SkinDir}/scripts/newscript.js"></script>
- Example of newscript.js:
Code:

<!--
{literal}
function printpage() {
window.print(); 
}
{/literal}
// -->


shipmerchant 05-21-2006 05:58 PM

Quote:

Originally Posted by Zaja
- Create scripts directory under skin directory.
- Call the external java script like this:
Code:

<script type="text/javascript" language="JavaScript 1.2" src="{$SkinDir}/scripts/newscript.js"></script>
- Example of newscript.js:
Code:

<!--
{literal}
function printpage() {
window.print(); 
}
{/literal}
// -->



Sorry for the long delay in giving you my personal thanks for your suggestions. I tried them but still cannot get it to work.

I followed your instructions above or at least I think, unless I missed something?

created folder "skin1/scripts"

then added this code to my home.tpl

<script type="text/javascript" language="JavaScript 1.2" src="{$SkinDir}/scripts/scroll.js"></script>

Then created "scroll.js" and placed in the skin1/scripts folder, here my code below:

{literal} <script language="JavaScript" type="text/JavaScript">
<!-- Begin
var Message="scrollMessagetoappear";
var place=1;
function scrollIn() {
window.status=Message.substring(0, place);
if (place >= Message.length) {
place=1;
window.setTimeout("scrollOut()",100);
} else {
place++;
window.setTimeout("scrollIn()",120);
}
}
function scrollOut() {
window.status=Message.substring(place, Message.length);
if (place >= Message.length) {
place=1;
window.setTimeout("scrollIn()", 100);
} else {
place++;
window.setTimeout("scrollOut()", 100);
}
}
scrollIn()
// End -->
</script>{/literal}

But I still cannot get this too work, could you please assist me?

thanks in advance and sorry if I am missing something here. :D

Zaja 05-22-2006 12:07 AM

Shipmerchant, just folow simple instruction from my fist reply.....you don't need <script language="JavaScript" type="text/JavaScript">, </script>, Begin and End in scroll.js.

What result do you expect to get from this javascript code?


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

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