Solved

window or body onload

Posted on 2004-04-12
5
6,655 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

930 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now