Reputation: 10672
I am able to capture click event any where on my form but there is an Iframe on my page when I click on that it doesn't get capture.
here is a code.
document.onclick = function(e) { alert(e.clientX + "|" + e.clientY); }
Thanx
Upvotes: 0
Views: 667
Reputation: 6986
Iframe's won't "bubble up" their click events to the parent window. You would have to put something similar on the Iframe page, like this:
document.onclick = function(e) {
if (window.parent.iframeClicked) {
window.parent.iframeClicked(e);
}
}
and then define the iframeClicked
function on your parent window:
function iframeClicked(e) {
/* your code here */
}
Upvotes: 1
Reputation: 22485
BreakHead,
As long as the frame is on your own domain, you could try:
<body onclick="parent.handleClickEvent(event)">
if it's a frame from another site, then the same domain policy won't allow access, in which case Google "javascript cross domain security"
Upvotes: 0