Only functions in first included script are available after onLoad

G

Gene Goykhman

Hi there. Has anyone experienced an intermittent problem where only functions
from the first included script tag are available to the onLoad event handler?
An example:

<html>
<head>
<script src="library1.js></script>
<script src="library2.js></script>
<script>
function doLoad()
{
functionCallFromLibrary2();
}
</script>
</head>
<body onLoad="doLoad();">
</body>
</html>

The script _ocassionally_ (once every 20 or 30 times, I would say) halts at
the functionCallFromLibrary2() with an Object Expected error. My debugger
tells me that, at this point in execution, all functions from library1.js are
defined and available but no functions from library2.js are available. Both
library1.js and library2.js are function libraries... there is no inline code
in either file.

Any insight? THANKS!!
-- Gene
 
J

Jürgen Riemer

hi Gene,

Gene said:
Hi there. Has anyone experienced an intermittent problem where only functions
from the first included script tag are available to the onLoad event handler?
An example:

<html>
<head>
<script src="library1.js></script>
<script src="library2.js></script>
<script>
function doLoad()
{
functionCallFromLibrary2();
}
</script>
</head>
<body onLoad="doLoad();">
</body>
</html>

The script _ocassionally_ (once every 20 or 30 times, I would say) halts at
the functionCallFromLibrary2() with an Object Expected error. My debugger
tells me that, at this point in execution, all functions from library1.js are
defined and available but no functions from library2.js are available. Both
library1.js and library2.js are function libraries... there is no inline code
in either file.

Any insight? THANKS!!
-- Gene

quick thought: try to call the doLoad-function from your both of your
external js-files (at the end) and modify the doLoad function like this

var counter=0;
function doLoad(){

if(++counter>1){
functionCallFromLibrary2();
}
}

lg

mord
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,685
Members
48,796
Latest member
Greg L.

Latest Threads

Top