JavaScript Programming JavaScript > Code Examples Add event handler listener to document Add event handler listener to document <html> <head> <title>W3C DOM Event Propagation - Happy Codings :-) Javascript Programming</title> <script type="text/javascript"> function init() { document.addEventListener("click", docEvent, true); } function docEvent(evt) { alert("Document level."); } </script> </head> <body onload="init()"> </body> </html>