tr有一个单击事件,其中有个td有一个checkbox,当我单击checkbox时不触发tr的事件,注意tr的单击事件是JavaScript写的且带了参数!

来源:互联网 发布:linux 内核调试kgd 编辑:程序博客网 时间:2024/06/08 16:25

你可以将input标签的onclick设置为不冒泡方式,就可以实现只有input标签响应onclick,举例如下:

<table border=1 width=100>
<tr onclick="alert('td')">
<td><input type="checkbox" onclick="window.event.cancelBubble=true;alert('input')"></td>
</tr>
</table>