[thelist] JavaScript onClick question.

Phil Turmel turmel-lap at turmel.org
Mon Aug 23 06:32:40 CDT 2004


Tim/Craig:

Event bubbling can be canceled, either with the event's 
.stopPropagation() method or .cancelBubble property...

Look here for more explanation, including cross-browser details:
http://www.quirksmode.org/js/events_order.html

Phil

Craig wrote:
> Hi Tim,
> 
> Yes, I will look into event bubbling
> 
> However if I add this onclick [1] to the link it will cancel the div's
> onclick alert.
> 
> [1] onclick="document.getElementById('thediv').onclick=null;"
> 
> Regards,
> Craig.
>  
> ----- Original Message ----- 
> From: "Tim Beadle" <Tim.Beadle at iop.org>
> To: <thelist at lists.evolt.org>
> Sent: Monday, August 23, 2004 7:31 PM
> Subject: Re: [thelist] JavaScript onClick question.
> 
> 
> 
>>thelist-bounces at lists.evolt.org wrote on 22/08/2004 16:04:59:
>>
>>>There is a DIV with an onClick alert, and a link with an onClick alert.
>>>What happens is if you click on the Link, the JS alert will popup "a
>>>onClick" and then "div onClick".
>>>
>>>How can I make it only popup "a onClick" ??
>>
>>Remove the div onclick? :)
>>
>>You might wish to look into how events are handled in different browsers.
>>I know IE uses one method and Moz another, and that one method is called
>>"event bubbling".
>>
>>HTH,
>>
>>Tim
> 
> 
> 


More information about the thelist mailing list