For the use of JavaScript in Zen Cart, the basic is to strip both of the header and footer of the normal JavaScript.
And in the body of your jscript_YOUR_JS.js OR on_load_YOUR_JS.js should only contain the JavaScript code's main body.
e.g.
The normal JavaScript code file should contain:
<script type="text/javascript">
...
THE CODE BODY
...
</script>
And for use in Zen Cart, only the code body should only be contained:
...
THE CODE BODY
...
And no header and footer are needed, because Zen Cart will handle the rest. :thumbsup:
You can check the results by viewing of the web page source.
- To check wether it loaded in the header or not, for the jscript_YOUR_JS.js
- For the on_load, if it loaded, it will also show with the JavaScript codes.
If you use the browser Firefox, get the extension FireBug to help.
What is it?
FireBug lets you explore the far corners of the DOM by keyboard or mouse. All of the tools you need to poke, prod, and monitor your JavaScript, CSS, HTML and Ajax are brought together into one seamless experience, including a debugger, error console, command line, and a variety of fun inspectors.