var last = null; document.onclick = function (event) { event = event || window.event; var target = event.target || event.srcElement; if (target == last) { ваша функцыя } last = target; };