How to load javascript on specific page only
Possible duplicate : How to include Javascript in xml-document?
How would I load a javascript file only only checkout pages? We are using onepage checkout. I have tried adding
<action method="addJs">
<script>myscript.js</script>
</action&开发者_开发技巧gt;
To various places on checkout.xml with no success
The page frame for the onepage checkout is loaded in the initial action. Try something like this:
<checkout_onepage_index>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/myscript.js</name></action>
</reference>
</checkout_onepage_index>
Then place your script in your skin directory under /js
.
Hope that helps!
Thanks, Joe
精彩评论