Windows.OnLoad doesn't consistently fire - why?

J

Joe Kehnast

I'm running a system on W2K web server with a Professional XP client.
I'm opening a window from an asp page using showModalDialog. In the
window I open I'm calling the onLoad event from the body tag. The
very first thing I put in the beginProcessing() function is an alert
saying I "got here." For some reason the event doesn't always fire
and my function doesn't run. Any ideas why?

I had to abandon this and came up with another solution because I
can't be 100% sure why the onLoad event isn't consistently firing.
Here's a solution I put in place but I'm not terribly in love with
doing it this way, but it seems to work.

You could argue that calling the onLoad event is the "right way" and I
would imagine most people would take that position. But, it doesn't
always work and it's driving my nuts. Any ideas why I can't use
onLoad and RELY on it????

Here's what I did and seems to work - for now.

<script language="JavaScript1.2">
window.setTimeout("beginProcessing()", 500);
</script>

If anyone could take a moment to respond I'd greatly appreciate it.

Thank you,
Joe Kehnast
CIGNA Corporation
 
D

DU

Joe said:
I'm running a system on W2K web server with a Professional XP client.
I'm opening a window from an asp page using showModalDialog.

This is an MSIE only method.

In the
window I open I'm calling the onLoad event from the body tag. The
very first thing I put in the beginProcessing() function is an alert
saying I "got here." For some reason the event doesn't always fire
and my function doesn't run. Any ideas why?

Not without more info on the page code, javascript functions involved,
placement of that code,etc.
I had to abandon this and came up with another solution because I
can't be 100% sure why the onLoad event isn't consistently firing.
Here's a solution I put in place but I'm not terribly in love with
doing it this way, but it seems to work.

You could argue that calling the onLoad event is the "right way" and I
would imagine most people would take that position. But, it doesn't
always work and it's driving my nuts. Any ideas why I can't use
onLoad and RELY on it????

Here's what I did and seems to work - for now.

<script language="JavaScript1.2">

type has superseded language.
window.setTimeout("beginProcessing()", 500);
</script>

If anyone could take a moment to respond I'd greatly appreciate it.

Thank you,
Joe Kehnast
CIGNA Corporation


Without the possibility to examine the whole page, there is not a lot we
can say for sure and it's impossible to diagnose correctly, accurately
what may be happening.

The more you had code like setTimeout(); and alert(), the more you may
be in fact interfering (or creating side effects in memory management)
with the execution of window creation and document loading.

DU
 
M

Markus Ernst

[...]

If you wrote Windows.OnLoad (as you do in the subject line of your posting)
try making windows a singular (window.onLoad).

HTH
Markus
 
G

Grant Wagner

Markus said:
[...]

If you wrote Windows.OnLoad (as you do in the subject line of your posting)
try making windows a singular (window.onLoad).

HTH
Markus

When events are listed as members of an object, they are all lowercase:
window.onload, anchorReference.onclick, etc.

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 

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
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top