Hi,
the proper way to do it is the following:
- copy the javascript file library (if any) in a folder of the style project
- declare the resource in the Layout.xml file of the style project , assigning a unique name to it (eg. myJS)
- in the template file, state that the template requires that javascript library using the wr:RequireResource tag (e.g. <wr:RequireResource ref="myJs"/> )
- write the JavaScript code that uses the library as you do in a HTML page
The <wr:Resource> tag prints all the necessary resources in the page.
The needed resources are automatically calculated at generation time by WebRatio.
This means that, everytime you use the template requiring the myJs resource, the tag is able to understand it and prints the reference in the generated page.
I suggest you to download some templates from the WebRatio Addons to see how they are written.
Some of them require JavaScript, so you can see how they are done.