1

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>

To various places on checkout.xml with no success

Community
  • 1
  • 1
Joe Riggs
  • 1,312
  • 4
  • 23
  • 48

1 Answers1

2

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

Joe Mastey
  • 26,809
  • 13
  • 80
  • 104