A Modular Toolbox
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
- Created by: Anthony Corbelli
- Web Site: http://www.htmlgoodies.com/
- Posted: November 24, 2008
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
(3 comments)I need a clear notes of javascript codes,or books
/* 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
Very g00d