Sets or retrieves whether the current event should bubble up the hierarchy of event handlers.
dhtml语法
event.cancelBubble [ = bCancel ]
DHTML可能的值
bCancel | Boolean that
specifies or receives one of the following values.false | Default. Bubbling is enabled, allowing the next event handler in the hierarchy to receive the event. | true | Bubbling is disabled for this event, preventing the next event handler in the hierarchy from receiving the event. |
|
The property is read/write.
The property has a default value of
false.
Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see about dynamic properties.
remarks
using this property to cancel bubbling for an event does not affect subsequent events.
DHTML代码范例
This example cancels bubbling of the onclick event if it occurs in the img object when the user presses the shift key. this prevents the event from bubbling up to the onclick event handler for the document.
<script language="jscript">
function checkCancel()
{
if (window.event.shiftKey)
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">
是否符合公共标准
There is no public standard that applies to this property.
Applies To