The <body> element
Contains all the actual content (rather than metadata) of an HTML document.
Full list of attributes
All the usual HTML global attributes are available
onafterprint- Called after a document has been printed, allowing JavaScript to undo modifications made by a
beforeprinthandler, or to acknowledge that a permanent copy of the document has been kept. onbeforeprint- Called before the document is about to be printed out, allowing JavaScript code to adjust the page to be print-ready.
onbeforeunload- Called when the page is about to be unloaded, so the page can ask the user if they're sure they want to close it.
onblur- Called when the document looses focus (for example when the user switches to another tab or to a different program).
onerror- Called when an error (usually caused by JavaScript failing) bubbles up to the
bodyelement. As well as the usualeventparameter, three other parameters are also provided:source,lineno, andcolumn. onfocus- Called when the document receives focus.
onhashchange- Called when the fragment identifier (the part after the
#) of the document's URI has been changed. onload- Called when the whole document has finished being downloaded and parsed.
onmessage- Called when the
Windowobject associated with this document receives a message. onoffline- Called when the browser has switched into offline mode (for example, if the network connection has been lost).
ononline- Called when the browser has switched to online mode (so a network connection is now available).
onpagehide- Called when this page is no longer the current entry in the browser's session history.
onpageshow- Called when this page has just become the current entry in the browser's session history.
onpopstate- Called when the user changes to a different page in the browser's session history.
onscroll- Called when the user vertically scrolls the window to view a different part of this web page.
onstorage- Called when the browser's
localStoragefacility is used. onunload- Called when the document is being unloaded, for example when its window is being closed.