HTML Window Event Handler Attributess
HTML window event handlers are those that triggered by changes happened at the page level.
It is applicable to the <body> tag.
For example, the following event handler "onload" will show an alert window when page loads.
<body onload="alert('test'); ">
Attribute list of <body> tag:
Attribute Names | Events |
onafterprint | After printing |
onbeforeprint | Before printing |
onbeforeonload | Before web page loads |
onblur | Window loses focus |
onerror | An error encountered |
onfoucs | Window get focus |
onhaschange | Content revised |
onload | When page loads |
onmessage | Message display |
onoffline | Page is offline |
ononline | Page is online |
onpagehide | When window became hidden |
onpageshow | When window became shown |
onpopstate | URL change |
onredo | Redo command executed |
onresize | Window resized |
onstorage | When page loads |
onundo | Undo command executed |
onunload | Leaves the page |
Note: Except onblur, onfocus, onload, all other attributes are only work for HTML5.