473,503 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Only functions in first included script are available after onLoad

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
Jul 20 '05 #1
1 2434
hi Gene,

Gene Goykhman wrote:
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

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6790
by: Da Costa Gomez | last post by:
Hi all, I've been eluded the last couple of *days* on the onload mystery within the frame and function context. Problem is as follows: - frameset with two frames. One called scripts and the...
7
3864
by: Randell D. | last post by:
Folks, I've found a nice menu piece of javascript that works fine when the code is included entirely inside the html page. However, when I place the javascript code outside, in its own ".js"...
3
1983
by: Disco-181 | last post by:
Hi, I have a script which isn't working in Mozilla based browser for some reason. I'm trying to run two functions from the body onload tag and it simply isn't happening. I have a cascading...
4
38228
by: Mark Hannon | last post by:
I am trying to initialize an array only once so it can be seen & used by any functions that need it. As I understand it, if a variable is declared by itself outside of any functions, its scope is...
5
2762
by: danny.myint | last post by:
I was under the assumption that javascript loads all the <head></head> elements before processing the <body> tag in Mozilla/Netscape/Firefox. It doesn't seem like it, with my problem. I have...
8
5451
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
7
2899
by: jsale | last post by:
I'm currently using ASP.NET with VS2003 and SQL Server 2003. The ASP.NET app i have made is running on IIS v6 and consists of a number of pages that allow the user to read information from the...
6
1414
by: Richard | last post by:
I am new to php and am looking for some quick "get up and go" help. What would the arguments for and against be for function declarations v simple include? e.g <?php include("myfunc.php");...
5
9404
by: lilOlMe | last post by:
Hi there! I'm developing some crazy Tab Control in .NET that uses JavaScript. A particular JavaScript method needs to be called during the window.onload event in order to initialize my Tab...
0
7204
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7342
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7464
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5586
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5018
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4680
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
391
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.