阻止冒泡 table表格取消选中最后一列
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
>
<
title
></
title
>
</
head
>
<
body
>
<
table
border
=
"1"
>
<
tr
onclick
=
"fn()"
>
<
td
id
=
"t1"
>取消了事件</
td
>
<
td
>点我,我没取消</
td
>
<
td
id
=
"t2"
>取消了事件</
td
>
</
tr
>
</
table
>
<
script
type
=
"text/javascript"
>
function stopBubble(e) {
if (e && e.stopPropagation) {
e.stopPropagation();
}
else {
window.event.cancelBubble = true;
}
}
document.getElementById('t1').onclick = function (e) {
stopBubble(e);
}
document.getElementById('t2').onclick = function (e) {
stopBubble(e);
}
function fn() {
alert('s');
}
</
script
>
</
body
>
</
html
>
<tr>
<td width="102" style="border-right-style:none">隐藏右边框</td>
<td width="119" style="border-left-style:none">隐藏左边框</td>
</tr>
<tr>
<td style="border-top-style:none">隐藏上边框</td>
<td style="border-bottom-style:none">隐藏下边框</td>
</tr>
<td width="102" style="border-right-style:none">隐藏右边框</td>
<td width="119" style="border-left-style:none">隐藏左边框</td>
</tr>
<tr>
<td style="border-top-style:none">隐藏上边框</td>
<td style="border-bottom-style:none">隐藏下边框</td>
</tr>
![](https://common.cnblogs.com/images/loading.gif)