javascript当中冒泡取消的用法
例 9.3(bubble2CancelIEFF.html)
马克-to-win:冒泡取消。event.cancelBubble
马克- to-win:马克 java社区:防盗版实名手机尾号: 73203。
<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" onclick="gotClick(event,'body元素');">
event.cancelBubble在ie和FF是通用的。
<p id="pq" onclick="gotClick(event,'p元素');">
<input type="button" id="buttonq" value="击我" onclick="gotClick(event,'按钮');"/>
</p>
</body>
</html>