[Javascript] Differences with event handlers

Terry Riegel riegel at clearimageonline.com
Mon Jul 12 12:57:36 CDT 2010


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



More information about the Javascript mailing list