By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,568 Members | 1,196 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,568 IT Pros & Developers. It's quick & easy.

How do I disable onclick event of one cell?

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a


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

P: n/a
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.