469,318 Members | 1,954 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,318 developers. It's quick & easy.

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 1537
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 zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.