<script> document.onclick = function click(e){ console.log(this); console.log(e); click.flag = !click.flag; console.log(click.flag); }; </script>