Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ONLOAD event firing too early.

Status
Not open for further replies.

benh

Programmer
Aug 7, 2001
1
GB
Has anybody else ever experienced a situation whereby an ONLOAD event placed in a tag starts executing before all the outputted text (in this case, XML) has appeared in the HTML it's called from? I say 'appeared' because the XML is written using Response.Write, but doesn't seem to appear in the page sent to the client until after the ONLOAD event has begun.

Basic structure of ASP page sent to client:

Code:
<html><head></head>

[javascript includes]

    <body ONLOAD=loadwin()>

[More HTML]

</body></html>

<xml>

[XML stuff]

</xml>

The HTML and XML are both written by the same procedure at the server. However, although all of the HTML / XML is written synchronously, when the client receives the response, the HTML appears and begins to execute ONLOAD javascript functions before the accompanying XML appears.

Some of the ONLOAD events call functions that depend upon the XML, and so fail.

I thought the problem might be buffer-related, but having removed any Response.Flush and Response.End statement, the problem still persists. Does anyone know of a method that might allow me to delay the ONLOAD events until the XML has been received?

Any help would be greatly appreciated.

Thanks.

 
Cite from devguru.com:
The onload event handler executes the specified JavaScript code or function on the occurance of a Load event. A Load event occurs when the browser finishes loading a window or all the frames in a window.

</html> works as a signal for finishing loading and you cannot delay it.

It seems that you have to put your <xml> ...</xml> before </html>

D.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top