FIX: Window_Onload Event Does Not Fire on ASP Page (190937)



The information in this article applies to:

  • Microsoft Visual InterDev 6.0

This article was previously published under Q190937

SYMPTOMS

When you Browse an Active Server Pages (ASP) page created using Visual InterDev, the window_onload event does not fire.

CAUSE

You have output in an event handler or navigate method prior to the <BODY> tag being written to the browser.

When you output HTML in server events (for example, by including response.write() statements in the thisPage_onenter event), the browser creates an implied <BODY> tag that overrides the attributes that you may have set on the tag, and the window_onload event is not fired.

RESOLUTION

To avoid this problem, defer all HTML output until the content portion of the page. Use script only to set up state that is used to compose the page. If you need to output HTML prior to the content portion of the page, then you should set the <BODY> tag attributes programmatically using client-side code [for example, window.onload = "return window_onload()"].

STATUS

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

This bug was corrected in Visual Studio 6.0 Service Pack 3.

For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

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

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed


Modification Type:MajorLast Reviewed:10/16/2002
Keywords:kbBug kbDSupport kbScript kbVS600sp3fix KB190937