Event
cancelBubble设置或获取当前事件是否要在事件句柄中向上冒泡。
Sets or retrieves whether the current event should bubble up the hierarchy of event handlers.
<SCRIPT LANGUAGE="JScript">
function checkCancel() {
if (window.event.shiftKey) //只要你按着shift键,就不会再触发BODY 的onclick了
window.event.cancelBubble = true;
}
function showSrc() {
if (window.event.srcElement.tagName == "IMG")
alert(window.event.srcElement.src);
</SCRIPT>
<BODY onclick="showSrc()">
<IMG onclick="checkCancel()" src="sample.gif">
用途:阻止父控件或以上级控件触发相应事件