RobG said the following on 11/18/2005 2:04 AM:[color=blue]
> RobG wrote:
>[color=green]
>> Joseph Scoccimaro wrote:[/color]
>
> [...]
>[color=green]
>>[color=darkred]
>>> I am currently getting no errors from the javascript panel in
>>> firefox. Here is the code I am using:[/color]
>>
>>
>>
>> There are tips on writing scripts here, I'll just comment on what you
>> posted:
>>
>> <URL:http://greasemonkey.mozdev.org/authoring.html>
>>[/color]
>
> Downloaded and installed Greasemonkey, the following works:
>
> (
> function addScript()
> {
> var theHead = document.getElementsByTagName('head')[0];
> var oScript = document.createElement('script');
> oScript.type = 'text/javascript';
> oScript.src = 'file://C:/fullPathToFile/blah.js';
> theHead.appendChild(oScript);
> }
> )();[/color]
function addScript(scriptSource){
......
oScript.src = scriptSource;
}
Allows it to be a general function to add a script file on the fly.
Which way one does it depends on the needs/desires at the time.
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/