recent project to do a message alert function, after the user login is completed, from the lower right corner of a message module, similar to QQ pop-up ads, but in the browser, a little more. The beginning of the practice is in $ (document). Ready () is used in the jquery slidedown display message div, because the page contains six or seven blocks is an IFRAME, each iframe load time is relatively long, the content is more, Results The IFRAME is not loaded, the message div out, and the animation of a card, the effect is unbearable. and then a piece of article on the jquery official web(http://learn.jquery.com/about-jquery/how-jquery-works/)Find the $ (document) for jquery. Ready () is not when the page is all loaded and then executed, but the current page of the DOM loaded after the execution, so high efficiency, fast. But to wait until the page is all loaded, including the internal IFRAME is loaded and then executed, but also to use the Window.onload event, the following is said Window.onload and $ (document). The difference between ready (). The main is the execution time is different, above also said Window.onload must wait until the page includes the picture, the IFRAME and so on all elements to execute after loading, and the $ (document). Ready () is executed after the DOM structure is drawn, without waiting for the load to complete, In other words, the image may not have been downloaded and the contents of the IFRAME have not been loaded. the execution time of the two is different, the effect is also different, in most cases $ (document). Ready () works better, but it is important to note that because $ (document) is executed when the picture is not loaded. Attributes such as image size are not necessarily valid. But when all the pages are loaded and then get a picture of the size, and wasted time, how to do? Fortunately, jquery provides us with a better way to use the Load method to bind the specified element to the event at the completion of loading, such as $ ("img"). Load (function () {...});Another benefit of the load method is that if you simply write the Window.onload register event, only the last one will be executed, and if you want to register more than one, you need additional code to judge, while the load method using jquery can register multiple events, $ (window). Load ( ) and window.onload are equivalent, but the Load method can register multiple events.