87,902
社区成员
发帖
与我相关
我的任务
分享
function cancel (evt) {;
var e=(evt)?evt:window.event;
if (window.event) {
e.cancelBubble=true;
} else {
//e.preventDefault();
e.stopPropagation();
}
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<script>
function a(event){
event.cancelBubble = true;
}
</script>
<table onclick="alert(1)">
<tr>
<td>
td
</td>
<td>
<input type="text" onclick="a(event)" />
</td>
<td>
td
</td>
</tr>
</table>
</body>
</html>
function stopBubble(e){
//非ie的
if(e&& e.stopPropagation)
e.stopProgpagation();
else
window.event.cancelBubble=true;
}