how do i detect which event I had clicked, suing javascript ? this includes when clicking on the Browser Back button too.
+1
A:
You can detect clicks inside the page with a simple click event handler:
document.onclick= function(event) {
// Compensate for IE<9's non-standard event model
//
if (event===undefined) event= window.event;
var target= 'target' in event? event.target : event.srcElement;
alert('clicked on '+target.tagName);
};
It is impossible for web-page script detect clicks outside the page such as the back button and other browser chrome, for good security reasons. You would have to be part of a browser extension to do this.
bobince
2010-04-12 12:34:49
+1 Bobince, you give great answers to not so great questions!
alex
2010-04-12 13:00:36