onload Event load Javascript DOM Tutorial Share / Like
The load event fires when a target resource(elements, files or objects) finishes loading. You can listen for load completion on individual elements, or the whole document if you like.
The following code makes sure the <body> element is finished loading before running script.
Scripting load events through Javascript and the DOM: