取消气泡事件,使得事件不再向上传递,下面的代码你去掉event.cancelBubble=true看看差异<body onclick="alert(this.tagName)">
<table width=300 height=100 border=1>
<tr><td onclick="alert(this.tagName);event.cancelBubble=true">
</td></tr>
</table>
</body>
<table width=300 height=100 border=1>
<tr><td onclick="alert(this.tagName);event.cancelBubble=true">
</td></tr>
</table>
</body>
<button onclick="alert('点击button的alert');event.cancelBubble=false;">允许事件冒泡</button>
<br>
<button onclick="alert('点击button的alert');event.cancelBubble=true;">禁止事件冒泡</button>