Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

javascript question


Recommended Posts

If you want to use an "onload" script or any other js that has a header tag, where do you put that part of the code? Every time I try to use one I end up getting an error message.

Link to comment
Share on other sites

Okay, I stumbled across a contrib that actually had an explanation included with the package. In case anyone else has wondered how to implement javascript on their pages, here's what I found:


To reduce clutter of javascripts within your files just create a folder called 'scripts' in your catalog directory.


Next create a new text document in your favourite text editor called for example. 'dropdowninfoboxes' and paste the javascript code without the beginning <script> and end </script> tags.


Than save your new script file with the extension .js instead of ie. .txt etc. and place this in the new folder you created called 'scripts'


Now to call it in any page you want just paste this code:


<script language="JavaScript">

<script src="scripts/dropdowninfoboxes.js"></script>


Put after this code

<link href="stylesheet.css" rel="stylesheet" type="text/css"> ... and before the ending </head> tag


Should look similar to this:


<link rel="stylesheet" type="text/css" href="print.css">


// begin call to javascript

<script language="JavaScript">

<script src="scripts/dropdowninfoboxes.js"></script>

// end call to javascript



<body marginwidth="10" marginheight="10" topmargin="10" bottommargin="10" leftmargin="10" rightmargin="10">

<!-- body_text //-->


Now no more messy javascript code mixed with your clean .php code.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...