Header files

For functions and more complicated modules, I create a text file that includes the script tag and src attribute, and bundle it with the module itself. Then, to use the functions, all that is necessary is to cut and paste the text from the 'header' file, and place the module itself in the appropriate directory. For example, the text file included with the cookie functions looks something like:

<script language="JavaScript" src="Cookies.js">
<!- Hide Script
// The Cookie module
//
// This module provides cookie functions.
// The two functions are getCookie() and setCookie()
// 
// The setCookie() function accepts two arguments: both strings.
// The first argument is the name of the cookie, followed by its value
// (Note: by default, the setCookie function sets a cookie to expire after
// one year's time)
//
// The getCookie() function accepts one argument: the name of the cookie
// to retrieve, and returns the value of the cookie, or null if the cookie
// doesn't exist.
// 
// Examples:
//
// setCookie("cookieName", "cookie value");
// if(temp=getCookie("cookieName") != null)
//     alert(temp);
// End script ->
</script>

The header file should include enough information for you to know how to use it, and what arguments need to be sent to the function. In the example above, I've included a lot of information because I plan on distributing the code. If I were going to be using the module strictly for my own purposes I might not comment it so thoroughly. And, if you want to get fancy, you could always create the header files in HTML, and make a master document that links to the individual header files.