RES: RES: [Javascript] Including additional javascript files

Allard Schripsema allard-schripsema at procergs.rs.gov.br
Mon Apr 4 14:01:28 CDT 2005


Alex,

If you?d tried the code you?d have seen that this function  also works with
nesting includes in other includes.
Just put the function in the first include, so that the rest of the code can
use it.

Allard Schripsema

-----Mensagem original-----
De: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu]Em nome de Alex Robinson
Enviada em: segunda-feira, 4 de abril de 2005 15:11
Para: [JavaScript List]
Assunto: Re: RES: [Javascript] Including additional javascript files


>you can do that like this:
>
>function Loadscript(name){
>    document.write('<script src="', name, '"
>type="text/JavaScript"><\/script>');
>}
>
>in your page something like:
><script>
>if (red == true) {
>    Loadscript("includeRed.js");
>}else{
>    Loadscript("includeBlue.js");
>}
></script>
>
>That should work..


Except that it's totally not what I want to achieve. I'm not after
conditionally including the files, I'm after being able to nest the
includes.

I could also insert the scripts by adding extra script elements
through the DOM. But that's also not what I'm trying to achieve.

Actually, now I think of it, seeing that it's really only browsers
that support the DOM that I'm targeting  (and providing there's some
graceful fallback for Mac IE5 which doesn't allow adding script
elements), that's a possible solution.

Still doesn't answer my original question though...
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list