the load event (aka "onload") in the window and / or body element will fire after loading the entire contents of the page - this includes all images, scripts, etc. .... everything.
In contrast, the jquery $(document).ready(...) function will use a browser-specific mechanism to ensure that your handler is called as soon as possible after loading and accessing HTML / XML. This is the earliest moment in the process of loading the page where you can safely run a script that intends to access the elements on the html dom page. This point arrives earlier (often much earlier) than the final load event, due to the extra time required to load secondary resources (such as images, etc.).
Lee Dec 09 '10 at 7:25 2010-12-09 07:25
source share