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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using onload in body doesn't seem to work in Netscape

Status
Not open for further replies.

cathl

Technical User
Aug 4, 2000
18
0
0
GB
Hi,
I am trying to move a layer when a page is loaded using onLoad=someFunction(). I need to put the function in the body of the document not the head, and this works fine in IE but not in Netscape 4. Does anyone know why?
Thanks.
 
cathl

Is it possible that someFunction() is IE specific, or might contain code to ignore NS? Very likely if you are working with DHTML, where the browsers employ quite different methods and attributes?

Cheers, NEIL
 
I already checked this, I know it works in Netscape because I added onClick=someFunction() to an image and on clicking the image the layer moves in both browsers.
 
Hmm. Another possiblity is that the onLoad event occurs before some element dimensions have been set for NS? I've seen some scripts to wait a couple of seconds to give the browser time to do additional work after the onLoad event has occured. Example:

Code:
function delayedFunction() {
    setTimeout( "someFunction()", 2000 );
}

<body onLoad=&quot;delayedFunction()&quot;>

Not very likely, but might be worth checking? Cheers, NEIL
 
Will try that one and let you know - thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top