On Mar 22, 12:04 pm, "gert" <gert.cuyk...@gmail.comwrote:
<table onclick="do_something()">
<tr>
<td id=1 onclick="do_something_else()"></td>
</tr>
<tr>
<td id=2></td>
</tr>
</table>
how can i make a do_something event that only happens when the
do_something_else event doesnt happen by clicking for example on the
second td ?
For a full explanation, read:
Quick explanation: pass the event to the function an use IE's
cancelBubble property or the W3C stopPropagation() method, see below.
<script type="text/javascript">
function fn0() {
alert('hi from fn0');
}
function fn1(e) {
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
alert('hi from fn1');
}
</script>
<div onclick="fn0();"
style="border: 1px solid red;">A div
<p onclick="fn1(event);"
style="border: 1px solid blue;">A paragraph</p>
</div>
--
Rob