hi

look at the this sample code:

<script language="javascript" src="lib/dynapi.js"></scirpt>
<script language="javascript">
DynAPI.include("somescript");
// now assume that somescript.js defines an object called myObject
// the pitfall: if you try to do
alert(myObject);
// on ie5/pc you will get an error saying myObject is not defined
</script>

the following works

<script language="javascript" src="lib/dynapi.js"></scirpt>
<script language="javascript">
DynAPI.include("somescript");
</script>
<!--end of first scriptblock -->
<script language="javascript">
alert(myObject);
</script>

i just split the scriptblock from the first example in two and it works.

my explanation for this is that ie won't do the document.write() in
DynAPI.include() before the current scriptblock has been executed. for the
first example this means that at the moment i want to do the
alert(myObject) "somescript" hasn't yet been executed and myObject is still
undefined.
in the second example the document.write() is done after the end of the
first scriptblock, somescript.js is loaded and executed.

This a problem of ie5/pc (never had problems with this on the ie5/mac,
couldn't test in ns6)

just wanted to mention this, maybe this knowledge can save some time to
somebody.
--
Michael Buerge




_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-dev

Reply via email to