[thelist] Javascript : cancel bubble with Safari

Christian Heilmann codepo8 at gmail.com
Thu Feb 16 03:12:33 CST 2006


> Oh.  No, I have a table and I want to allow clicking on any part of
> the row and follow a link.  Hence the onclick on the <tr>.
>
> But, I also have a few <a> links inside the row, so when those are
> clicked I don't want the outer <tr> onclick to *also* run.  That's
> what the cancel bubble is all about.

Hmm, I think it is not that easy. The solution is to have an onclick
handler on both the TR and the As inside and it check the nodeName of
the element that was activated. Fiddling with Z-index for the links
might also help.

Logically this doesn't make sense: You want a whole area that is not
interactive clickable and then you want just some of it not clickable
but leave it to the real interactive elements. This would really
confuse me as a user, why don't you just make those rows clickable
that don't have links (or one) in them (and indicate that they are
clickable via a hover state) and keep those with several links as-is?


--
Chris Heilmann
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/
Binaries: http://www.onlinetools.org/



More information about the thelist mailing list