[Javascript] Including additional javascript files

Paul Novitski paul at novitskisoftware.com
Mon Apr 4 11:48:00 CDT 2005


At 05:30 AM 4/4/2005, Alex Robinson wrote:
>Some time ago I stumbled across a technique for including additional 
>external javascript files that mirrored the way that additional CSS files 
>can be included via the @import statement.


Alex,

A <script> tag in the header can reference an external file:

         <script src="external.js" type="text/javascript"></script>

You can then initiate the script on page-load entirely from the external 
script without having to embed behavior in your html file (repeat after me: 
body onload bad, window.onload good!).  See my posting to this list 
yesterday Re: [Javascript] CSS and Javascript, and many articles on the net 
about separating behavior from structure such as 
<http://www.digital-web.com/articles/separating_behavior_and_structure_2/> 
by Peter-Paul Koch.

Paul 





More information about the Javascript mailing list