[thelist] Javascript : cancel bubble with Safari

Bill Moseley moseley at hank.org
Mon Feb 13 22:02:00 CST 2006


I have a table that includes <a> links in the <td>s, but I also have
onclick actions on the <tr> rows.  If the <a> links are clicked I
don't want the event to bubble up to the <td>.

So, I use Behaviour to set on onclick handler on all the <a> within
the <td>s.

    '#matrix td a' : function(e){
        e.onclick   = function(e){
            if (!e) var e = window.event;
            e.cancelBubble = true;
            if (e.stopPropagation) e.stopPropagation();
            return true;
        }
    }

This seems to work on Firefox and IE, but in Safari the links just
don't work, and only the onclick on the <tr> works.

I'm wondering if this is a problem with how I'm cancelling the bubble
or if it's a problem with Safari and I just should not use an onclick
on the <tr>.

By the way...

Another odd thing about my (new) ibook is that some background colors do
not display -- it's the same thing on Safari, IE, and Firefox on the
ibook -- some background colors just don't show.  They show fine on
my old Powermac (and on my Linux and Windows machines).  Anyone see
this before?  If I do a screen capture and then display that on my
Linux machine the background colors show.  The ibook's display seems
to be setup correctly (millions of colors, etc) and brightness has no
effect.  Weird.






-- 
Bill Moseley
moseley at hank.org




More information about the thelist mailing list