Solved

window or body onload

Posted on 2004-04-12
5
6,660 Views
Last Modified: 2012-06-27
I have a script that generates the size of div's on a page, but there's a noticeable delay in IE.
Is there any functional difference (in how fast the browser process the script) by using window.onload or body onload

Thanks,
Sean
0
Comment
Question by:seanpowell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10808407
i mainly use

<head>
<script>
window.onload = function(){
     // do something
        // ...and something a lil more complex
}
</script>
</head>

and never have any timing problems.

another option may be to have everything (HTML) in a div container and leave it hidden for X seconds and when your script gets
thru processing have a statement in it that says if (done) show the container

hope this helps
0
 
LVL 31

Author Comment

by:seanpowell
ID: 10808432
Well the script just compares the height of one div based on its internal content, and then makes the div next to it the same height.

In IE though, the window loads, and "then" the div stretches to match the other one. I was just curious if window or body onload were two different things or not...
0
 
LVL 16

Accepted Solution

by:
jaysolomon earned 500 total points
ID: 10808458
i like window.onload = ....... i feel (and this is my opinion) that when the pages gets hit it will see window...... before the DOM gets to body onload=.............

this is my opinion
0
 
LVL 31

Author Comment

by:seanpowell
ID: 10817751
You're opinion's always been good enough for me jAy :-)
Pts increased...
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10823030
glad to have helped and thanks for the A and Points
jAy
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question