sa********@gmail.com said the following on 7/30/2006 8:39 PM:
Here is the function with the code:
function Start1(event) {
include("phase.js"); // a function that includes an external javascript
file on the fly
include("answerkey.js");
alert('debug message') //<---THIS is the problem, if i remove this
line, I get an error
getPhases(); //another function which works fine as long as the alert
is there
}
Any help would be great
It is a timing issue where you are trying to call a function in the
external file before that file gets loaded.
The browser won't wait for that file to load before continuing. The
alert pauses the script execution long enough for the file to load and
then you get no errors. Removing the alert removes that pause so you get
the error.
It is not the alert that is stopping the error but rather it is the stop
in execution caused by the alert that prevents the error.
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq & newsgroup weekly
Temporarily at:
http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/