[thelist] javascript processing question

Keith cache at dowebscentral.com
Thu Apr 18 12:30:01 CDT 2002


Russ

>this seems to run beautifully on IE and Netscape on win2000, but no browser
>on the mac can get past the first 'for' loop without returning 0 for the new
>array's length property. it also failed on IE5 for windows NT4. much
>obliged.
>  russ alderson

Something you might try - the array is contained in an external javascript,
you are assuming that that file and array has loaded by the time you start
to use the array. That does not necessarily happen when you place the tag
calling the external js file in the document's head.

Instead, place the tag calling the external js file, and the script block
reading that array, in the document's body right after the body tag.
Placing a tag for an external js in the body forces the browser to suspend
renduring the page until after the script has loaded since it may contain
document.write statements that would effect page layout. In your case, the
external js file contains data that is used in the later document.write
statements so you also need to suspend renduring until that array has
loaded. Different browsers on different OS seem to work differently on this
situation but I've corrected this problem in the past by moving the scripts
to the body.

Hope that helps


keith

cache at dowebscentral.com




More information about the thelist mailing list