A Modular Toolbox | JavaScriptSource

A Modular Toolbox

Anthony Corbelli Nov 24, 2008

General

Creating and maintaining an effective JavaScript toolbox can greatly reduce development time. This script will show you how to include specific snippet modules on individual pages. Comments and a tutorial are included.


Notes

A tutorial is available, with complete details.

Source Code

Paste this source code into the designated areas.

External file

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


Head

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


Leave a Response

(4 comments)

i like it

prashant Jan 15, 2014

I need a clear notes of javascript codes,or books

CORNEL BALTHAZAL Aug 16, 2012

/* This script and many more are available free online at The JavaScript Source!! http://www.javascriptsource.com Created by: Anthony Corbelli | http://www.htmlgoodies.com/ */ // This function returns a collection of elements, an array of 1 is still an array. var cHead = document.getElementsByTagName("head"); // Select the first element (remember, indexed arrays start at 0 not 1). var hHead = cHead[0]; // Takes the Javascript file name and adds it to the document as a script function AddModule(mFileName) { var sTag = document.createElement("script"); // Create a SCRIPT tag sTag.setAttribute("src", mFileName); // Set the SCRIPT src=mFileName sTag.setAttribute("type", "text/javascript"); // set the SCRIPT type="text/javascript" hHead.appendChild(sTag); // Add it to your header section (parsed

narzz Aug 7, 2012

Very g00d

Carmin beltran Dec 4, 2008