[Javascript] Differences with event handlers

Terry Riegel riegel at clearimageonline.com
Mon Jul 12 15:41:50 CDT 2010


Thanks all for the hints. I not exactly clear about how this all works, but I have a "better" understanding.

Here is my working example to demonstrate what I was trying to do. I have paired it way back just to illustrate what I was attempting to do. It is all part of a bigger picture at clearjs.org

But here is the URL that demonstrates how I was able to stop propagation...

http://clearjs.org/apps/clear/stoppropagation.html

I was able to test it on FF, Safari, Chrome, and IE6,7,and 8.

Thanks again for the pointers,

Terry Riegel




On Jul 12, 2010, at 2:23 PM, Peter Brunone wrote:

> Nothing like getting ready for disappointment :)
> 
> ----------------------------------------
> From: "Terry Riegel" <riegel at clearimageonline.com>
> Sent: Monday, July 12, 2010 12:58 PM
> To: "JavaScript List" <javascript at lists.evolt.org>
> Subject: Re: [Javascript] Differences with event handlers
> 
> Peter,
> 
> I am planning for a degraded experience, yes.
> 
> Matt, David,
> 
> Thanks for the advise I will work on implementation.
> 
> Terry
> 
> On Jul 12, 2010, at 10:27 AM, Peter Brunone wrote:
> 
>> Do you have to use an anchor at all? Why not just a div or button? That 
>> way there's no default behavior that you have to cancel... or are you 
>> trying to plan for js-less clients?
>> 
>> ----------------------------------------
>> From: "Terry Riegel" <riegel at clearimageonline.com>
>> Sent: Monday, July 12, 2010 8:51 AM
>> To: "JavaScript List" <javascript at lists.evolt.org>
>> Subject: [Javascript] Differences with event handlers
>> 
>> Hello All,
>> 
>> I have an issue with event handlers and am not sure how to resolve it...
>> 
>> I can handle a click event for an anchor one of two ways...
>> 
>> 1. anchorObj.addEventListener( 'click', fn, false ); // or attachEvent
>> 
>> or
>> 
>> 2. anchorObj.onclick=fn;
>> 
>> With the second method I can "return false;" from fn and it stops the 
>> browser from doing the normal thing, but with the addEventListener it 
> still 
>> sends the anchor.
>> 
>> What is the best way to get the first method to work like the second 
> one.
>> 
>> Thanks,
>> 
>> Terry
>> _______________________________________________
>> Javascript mailing list
>> Javascript at lists.evolt.org
>> http://lists.evolt.org/mailman/listinfo/javascript
> 
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript
> 
> 
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript



More information about the Javascript mailing list