例 9.3(bubble2CancelIEFF.html)
冒泡取消。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
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。