470,604 Members | 2,179 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,604 developers. It's quick & easy.

How do I disable onclick event of one cell?

Hello,

I've got a table row with an onClick event that loads page1.
Now I do not want to apply this event to one cell of that row because
that cell contains already a link to another page. How do I disable
the onClick event on that one cell? Code:

<table>
<tr onClick="window.location=page1.html'>
<td></td>
<td></td>
<td></td>
<td></td>
<td><a href="page2.html"></td>
</tr>
</table>

Thnx,

Barton
Jul 20 '05 #1
2 10868


Barton wrote:
I've got a table row with an onClick event that loads page1.
Now I do not want to apply this event to one cell of that row because
that cell contains already a link to another page. How do I disable
the onClick event on that one cell? Code:

<table>
<tr onClick="window.location=page1.html'>
<td></td>
<td></td>
<td></td>
<td></td>
<td><a href="page2.html"></td>


Try
<a onclick="if (event.stopPropagation) {
event.stopPropagation;
}
event.cancelBubble = true;
return true;"
href="page2.html">link</a>

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
Martin Honnen <ma*******@yahoo.de> writes:
<a onclick="if (event.stopPropagation) {
event.stopPropagation;


Should be: event.stopPropagation();

Otherwise I agree completely.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by MEM | last post: by
2 posts views Thread by Andreas Knollmann | last post: by
3 posts views Thread by Jeff | last post: by
4 posts views Thread by Chris | last post: by
5 posts views Thread by Sehboo | last post: by
2 posts views Thread by =?Utf-8?B?Uml0YUc=?= | last post: by
18 posts views Thread by joaotsetsemoita | last post: by
5 posts views Thread by Geoff Cox | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.