Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

window or body onload

Posted on 2004-04-12
5
Medium Priority
?
6,666 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 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
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…
Suggested Courses

926 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