[thelist] onclick in table row
Sam Beam
sbeam at syxyz.net
Tue Jan 27 08:54:59 CST 2004
On Tuesday 27 January 2004 05:16, kris burford wrote:
> >i've some legacy code that is littered with tables containing
> > onclick links in table rows and standard links in the td. (as
> > below). it means the rows highlight nicely on mouseover (via css)
> > but the client (on macs) say that the td links don't work.
> >
> ><tr class="dataTableRowSelected"
> > onmouseover="this.style.cursor='hand'"
> > onclick="document.location.href='foo.html">
> ><td><a href="bar.html">link</a></td>
> ></tr>
This might be a sticky problem, you are maybe looking at a big fat juicy
IE/Mac bug. But look into event capturing/bubbling. Check out this
page:
http://www.brainjar.com/dhtml/events/default3.asp
and you just have to make sure that IE/Mac is NOT cancelling the bubble
by default for some reason.
here is function to intentionally stop the <A> tag from having an effect
when wrapped in a certain magic div, FWIW:
// cross-browser way of getting events to cancel bubbling
function grindToHalt(e) {
if (! e) {
alert ('no event received');
}
else if (e.stopPropagation) {
e.stopPropagation(); // use w3c standard
if (e.cancelable) e.preventDefault();
}
else {
e.cancelBubble = true; // use IEs special methods
e.returnValue = false;
}
}
}
More information about the thelist
mailing list