javascript当中冒泡取消的用法
例 9.3(bubble2CancelIEFF.html)
马克-to-win:冒泡取消。event.cancelBubble
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<script type="text/javascript">
function gotClick(event, who) {
alert(who);
event.cancelBubble=true;
// alert(who + " currentTarget is " + event.currentTarget.id + " eventTarget is " + event.target.id);
var zhanwei = "zhanwei";
}
</script>
</head>
<body id="bodyq" οnclick="gotClick(event,'body元素');">
event.cancelBubble在ie和FF是通用的。
<p id="pq" οnclick="gotClick(event,'p元素');">
<input type="button" id="buttonq" value="击我" οnclick="gotClick(event,'按钮');"/>
</p>
</body>
</html>
更多内容请见原文,文章转载自:https://blog.csdn.net/qq_43650923/article/details/102823874