473,378 Members | 1,175 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Windows.OnLoad doesn't consistently fire - why?

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
Jul 23 '05 #1
4 4993
In article <be**************************@posting.google.com >,
jo************@cigna.com (Joe Kehnast) wrote:
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?
Any chance of seeing the page? I'd put an alert in the onload clause
and don't use the do the old double quoting in the alert as I do.
Function might not be defined etc. I think onload is reliable. Maybe
hidden graphic isn't being loaded.

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

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


I suggest coding the script tag as:
<script type="text/javascript">

Although you are not using Netscape, Javascript 1.2 invokes a slightly
different Javascript implementation in Netscape. The clause if (a = b )
means if (a == b) in Netscape Javascript 1.2.

And why go with a down level version of Javascript.

Robert
Jul 23 '05 #2
DU
Joe Kehnast wrote:
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
Jul 23 '05 #3
"Joe Kehnast" <jo************@cigna.com> schrieb im Newsbeitrag
news:be**************************@posting.google.c om...

[...]

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

HTH
Markus
Jul 23 '05 #4
Markus Ernst wrote:
"Joe Kehnast" <jo************@cigna.com> schrieb im Newsbeitrag
news:be**************************@posting.google.c om...

[...]

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 <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_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-deve...upgrade_2.html
Jul 23 '05 #5

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

Similar topics

1
by: Robert Oschler | last post by:
I have an frame in one of my documents (not a frameset document). The top level document has an "onload" handler in the BODY tag. I have found that if the frame is unable to navigate to the...
2
by: Bender | last post by:
Hi, I am wanting to capture an onmousedown event without firing the body tags onload event. Also, if anyone could explain why this happens that would be excellent. I can't see how an...
3
by: Christian | last post by:
hi, what is the difference between the Page_Load() and OnLoad() event handlers. do they originate from a different point ?
1
by: Oleg Ogurok | last post by:
Hi all, I have a small image ("Loading..." icon) that I hide using Javascript once the page finishes loading. To do so, I attach to the client side onload event. However, as soon as I turn on...
17
by: B. Chernick | last post by:
I'm trying to create a web page and I need a javascript function to be called on the load of a particular panel. (The panel is hidden during some but not all postbacks.) The function is bound...
3
by: Mike Cain | last post by:
Hi I have a JS library that I want others in my company to use that uses AttachEvent (etc) to add a method to the onLoad event so that it is called. Using this approach of course is good because...
20
by: Mark Anderson | last post by:
Hi, I have this in an external JS library: ///////////////////////// function addMyEvent(){ var obj; if(document.attachEvent) { obj = document.getElementsByTagName('img'); for...
0
acoder
by: acoder | last post by:
Problem onload and onunload events do not fire when going back, forward or refreshing the page Browser Opera Example Any code using onload or onunload, e.g. window.onload = init; where...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.