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 beforeprint handler, 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 body element. As well as the usual event parameter, three other parameters are also provided: source, lineno, and column.
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 Window object 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 localStorage facility is used.
onunload
Called when the document is being unloaded, for example when its window is being closed.

Further information

The Web Design Academy Contact us

By form

By Phone

+44 (0)113 234 4611

By email

enquiries@thewebdesign.academy

By snail mail

Suite 3 15 South Parade Leeds LS1 5PQ United Kingdom