Contents Index Topic Contents | ||
Previous Topic: button Next Topic: caption |
cancelBubble
Description
Specifies whether the current event should bubble up the hierarchy of event handlers.
Syntax
object.cancelBubble[ = cancelBubble]
Settings
This read-write property takes a Boolean value:
TRUE Cancels bubbling for this event, preventing the next event handler in the hierarchy from receiving the event. FALSE Enables bubbling. This is the default value. Using this property to cancel bubbling for an event does not affect subsequent events.
Example
The following document fragment cancels bubbling of the onclick event if it occurs in the IMG element when the SHIFT key is down. 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">Applies To
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.