JavaScript Includes | JavaScriptSource

JavaScript Includes

JavaScriptSource Staff Jun 1, 2007

General

When you start using Prototype, Scriptaculous, and other JavaScript libraries, you often end up with a dozen lines of script tags pulling in all of the code from different places. That would be fine if you never added a new library or never needed to swapped them out. This script will create a single JavaScript loader for each project that contains all of the scripts necessary.


Notes

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: multiLoader.js


Head

Paste this code into the HEAD section of your HTML document.


Leave a Response

(2 comments)

Not to be a party pooper, but how is this any easier than just creating a multiLoader.js and populating it with a:[br /]document.write("<script type='text/javascript' src='script1.js'></script")[br /]for each library you need loaded? Aside from being no more dificult to set up, this method also allows for js files in multiple locations, since they can be referenced relatively or absolutely.

tweak Jun 1, 2007

Great! Just what I was looking for!

James Jun 1, 2007