Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

window or body onload

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

670 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