DOM Enlightenment Book

by peroli

HTML

<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
<div>click me</div>

JavaScript

//click on the <div> or the <body> the value of this remains the <body> element node
var onclick = function(){
	console.log(this); //log <body>...</body>
};
document.body.addEventListener('click', onclick, false);
document.body.addEventListener('click', onclick, false);