onload Attributeonload AttributeThe onload attribute may be used on
the body element
to specify script to be executed immediately after the page has been
fully loaded. For example, it is necessary to wait until the page has fully
loaded before using the DOM so any
script which does this should be triggered by an onload handler.
See also the onunload and
defer attributes.
If you use this attribute (or any attributes of Type Script) the MIME type of the scripting language used should always be provided in a Content-Script-Type HTTP header.
It is good practice not to use these attributes, however,
and instead to include external scripts (via
script elements)
which add any handlers unobtrusively. This makes code more self-contained and
also the XHTML is easier to maintain if it doesn't contain any events attributes.