[Javascript] Including Files
Walter Torres
walter at torres.ws
Sat Nov 22 09:36:33 CST 2003
> -----Original Message-----
> From: javascript-bounces at LaTech.edu
> [mailto:javascript-bounces at LaTech.edu]On Behalf Of Tim Makins
> Sent: Saturday, November 22, 2003 9:08 AM
> To: [JavaScript List]
> Subject: [Javascript] Including Files
>
>
> <SCRIPT SRC="my_page.js"></SCRIPT>
>
> The above line lets me include an external script in my page.
>
> I have two questions about this...
This is how I do it...
Walter
========================================
var strIncludeFile = './scripts/jsValidate.js';
// Now include this file as well!
includeFile ( strIncludeFile );
// Generic INCLUDE statement that works across all the browsers!
// Believe it or not!
function includeFile ( strFilePath )
{
var strIncludeCode = '<script src="' + strFilePath + '"';
strIncludeCode += ' language="JavaScript"';
strIncludeCode += ' type="text/javascript">';
strIncludeCode += '</script>';
document.write ( strIncludeCode );
}
More information about the Javascript
mailing list