Microsoft KB Archive/190679

= FIX: The Window_Onload Event Fails to Fire When Page Loads =

Article ID: 190679

Article Last Modified on 8/7/2007

-

APPLIES TO


 * Microsoft Visual InterDev 6.0 Standard Edition

-



This article was previously published under Q190679



SYMPTOMS
The window_onload event fails to fire when the page is loaded.



CAUSE
You will see this behavior when either of the following is true:
 * The Scripting Object Model is enabled for the page (the body is enclosed within a form).
 * A DTC is placed before the  tag.



RESOLUTION
If the Scripting Object Model is enabled or the body is enclosed in a form, use the following workaround:
 * 1) Change the BODY tag to read  (remove the language and onload parts of the tag).
 * 2) Place the contents of your code in a script block designated for the window_onload event.

If a DTC is placed before the  tag, work around the problem by moving the DTC after the  tag.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Microsoft Visual Studio 6.0 Service Pack 5. For additional information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That a Visual Studio Service Pack Is Installed

To download the latest Visual Studio service pack, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/vstudio/Aa718353.aspx



MORE INFORMATION
When creating a script block designated for the Window_Onload event, no function header is required. The following code would bring up an alert when the page is loaded: 

Steps to Reproduce Behavior

 * Place a DTC before the  tag on a page. -or-
 * Enable the Scripting Object Model.

Keywords: kbbug kbctrl kbfix KB190679

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.