principle Comparison :
Body.onload (function ()) is a priority to render the DOM of the document, the page will be all the elements (including HTML tags and the referenced image, Flash media and other media files) to complete the loading, and then execute the page script;
$ (Windows). Load (function ()) has the same effect as body.onload (function ()).
$ (document). Ready (function ()) is a priority to load the document structure (excluding non-text media files such as pictures), which is to load the HTML DOM first and then execute the script.
★$ (document) instance of Ready (function ())
<script src="js/jquery-1.7.2.min.js"></script> <script> function MyFunction () { $ ("#test"). HTML ("Changed " ) } $ (document). Ready (myFunction); /* $ (document). Ready () is preferred to load the document structure (not including pictures and other non-text media files), do not have to wait until all the loaded */ </SCRIPT><H1 id="test">Original
★$ (document) instance of Ready (function ()) 2
★$ (window). Instance of Load (function ())
/*$ (window). Load (function) is executed after all elements of the page (including HTML tags and all images, Flash, and other media) have been loaded and executed in the same order as body.onload (function). */$ (window). Load (function () {alert ("Hello"); }); /*set two load (function) in parallel*/$ (window). Load (function () {alert ("See you again!") }) /*$ (window). Load (function) is executed after all elements of the page (including HTML tags and all images, Flash, and other media) have been loaded and executed in the same order as body.onload (function). */
Example of Body.onload (function ())
Compare Body.onload (function ()), $ (document). Ready (function ()) and $ (Windows). Load (function)