In an onload function, the contents of it ran after the object that is calling is fully loaded.
In a window onload function, the contents of the method are only accessible or can be run only after all the DOM, images, etc. of the window are loaded and it applies to the whole window which may take some time to load. It is used when you want the javascript to fire only after all the contents of the window are loaded.
In a body onload function, the contents of the method are accessible or ran after the contents of the body tag are loaded. Compared to the window onload function it takes less time to be fired. It is used when you want the javascript to fire only after all the contents of the body tag are loaded
Check out Web Development training and enroll today!