When Does A Body Onload Gets Called?
I need to understand when does a body's onload gets called I read in w3school that onload=Script to be run when a document load what does this mean? Does it mean that the html/js
Solution 1:
Unlike w3schools, MDN explains when the event is fired:
The load event fires at the end of the document loading process. At this point, all of the objects in the document are in the DOM, and all the images and sub-frames have finished loading.
So the DOM tree is ready and all elements have been loaded.
Solution 2:
The onLoad
event is fired after the successful completion of the dom tree, e.g. the successful loading of all the elements inside the body.
Solution 3:
The onload event is triggered when the DOM tree is ready. This means that all elements on your page are available to the script. Document.onload may be triggered before the page is rendered or images are loaded.
Post a Comment for "When Does A Body Onload Gets Called?"