Add event handler listener to document
<html>
<head>
<title>W3C DOM Event Propagation</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>
Related examples in the same category