471,887 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,887 software developers and data experts.

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

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
2 1604
mrhoo
428 256MB
Sure- anytime you click on the page and not on a link.
Mar 27 '08 #2
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.

Similar topics

2 posts views Thread by Paolo Mancini | last post: by
4 posts views Thread by Dave H | last post: by
5 posts views Thread by Mark Szlazak | last post: by
9 posts views Thread by VK | last post: by
4 posts views Thread by Wee Bubba | last post: by
7 posts views Thread by Girish | last post: by
17 posts views Thread by dan_williams | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.