Actually, it is the "nesting" that causes the problem. The first
Include call creates this:
<script>
contents of level1.js
</script>
But because level1 contains Include calls also, this is what results:
<script>
<script>
contents of /util/objectUtil.js
</script>
<script>
contents of /util/arrayUtil.js
</script>
<script>
contents of /util/stringUtil.js
</script>
<script>
contents of /select/select.js
</script>
</script>
Because the contents of a <script> section is not executed until AFTER
it is closed (</script>), The initial code has no problems, becuase it
contains no other tags when it is executed.
Unfortunately, there is no way of getting around this.
To get this kind of functionality in the AfroAPI, I had to use Java /
ActiveX.
Jonah wrote:
>
> Michael, thanks for the suggesion.
>
> If that were the problem, though, the code should also fail
> when there is only a single include. Since it only fails when
> I do two or more, I think it must be something else. Any other ideas?
>
> Thanks,
> Jonah
>
> -----Original Message-----
> From: Michael Pemberton [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 20, 2001 6:04 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [Dynapi-Help] mystifying problem -- please help!
>
> Problems like this can be cause by haing <script> tags inside other
> <script> tags. Try avoiding this wherever it occurs.
>
> Jonah wrote:
> >
> > I am using a custom-built javascript file include function (code at bottom
> > of email)
> > to include .js files within other .js files, and have created some code
> > that works fine in IE and NS6, but crashes NS4.7 (the page never finishes
> > loading).
> >
> > The root file has the following four lines:
> > <script language="Javascript" src="main.js"></script>
> > <script language="Javascript">
> > Main.include("level1.js")
> > </script>
> >
> > The problematic lines in level1.js are as follows:
> >
> > Main.include("/util/objectUtil.js")
> > Main.include("/util/arrayUtil.js")
> > Main.include("/util/stringUtil.js")
> > Main.include("/select/select.js")
> >
> > If I comment out all but one of the includes, the code is ok:
> > it only crashes when I try to include more than one file. Does anyone
> > have any idea what's causing this?
> >
> > thanks,
> > jonah
> >
> > Code for main.js
> > ------------------
> > function Main() {}
> > Main.include = includeFile
> > Main.basePath = "/tms/js"
> >
> > function includeFile(name,path) {
> > var path = path ? path : Main.basePath
> > fullPath = path + name
> > document.writeln('<script language="Javascript" src="' + fullPath
> +
> > '"><\/script>')
> > }
> >
> > _______________________________________________
> > Dynapi-Help mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/dynapi-help
>
> --
> Michael Pemberton
> [EMAIL PROTECTED]
> ICQ: 12107010
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dynapi-help
--
Michael Pemberton
[EMAIL PROTECTED]
ICQ: 12107010
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help