By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,223 Members | 1,434 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,223 IT Pros & Developers. It's quick & easy.

how to allow event bubbling if an intermediate handler stopped its propagation

P: 11
hi,

in MSIE, you can attach onclick event to both anchor and document objects.
here is some code :

document.onclick = function() {alert('document clicked ...'); }

<a href= " " onclick="clickHandler"></a>


function clickHandler(){

alert('anchor clicked ... ');

}


now, its supposed that if I clicked the anchor, both clickHandler, and document onclick handler will be called, this is what is called event bubbling .

now if rewrite the clickHandler as :

function clickHandler(){

event.cancelBubble = true ;

alert('anchor cliked ... ');


}

now, the document onclick handler is not called, since the anchor onclick handler stopped the bubbling of the event.
guys, is there anyway for document onclick handler to be invoked, even that anchor onclick event handler stopped the event bubbling !!!

thanks .
Mar 27 '08 #1
Share this Question
Share on Google+
2 Replies


100+
P: 428
Sure- anytime you click on the page and not on a link.
Mar 27 '08 #2

P: 11
Sure- anytime you click on the page and not on a link.
what about clicking the link itself !!
Mar 27 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.