Microsoft HomeproductssearchsupportshopWrite Us   Microsoft Home
Magazine
 |  Community
 |  Workshop
 |  Tools & Samples
 |  Training
 |  Site Info

Workshop  |  DHTML, HTML & CSS

cancelBubble Property


Sets or retrieves whether the current event should bubble up the hierarchy of event handlers.

Syntax

HTMLN/A
Scriptingevent.cancelBubble [ = bCancel ]

Possible Values

falseEnables bubbling.
trueCancels bubbling for this event, preventing the next event handler in the hierarchy from receiving the event.
The property is read/write with a default value of false.

Remarks

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 object when the SHIFT key is down. This prevents the event from bubbling up to the onclick event handler for the document.

Sample Code

<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

HTML N/A
Scripting event

Does this content meet your programming needs? Write us!

Back to topBack to top

© 1998 Microsoft Corporation. All rights reserved. Terms of use.

 

Magazine Home
Ask Jane
DHTML Dude
Extreme XML
For Starters
More or Hess
Servin' It Up
Site Lights
Web Men Talking
Member Community Home
Benefits: Freebies & Discounts
Benefits: Promote Your Site
Benefits: Connect with Your Peers
Benefits at a Glance
Online Special-Interest Groups
Your Membership
SBN Stores
Join Now
Workshop Home
Essentials
Content & Component Delivery
Component Development
Data Access & Databases
Design
DHTML, HTML & CSS
Extensible Markup Language (XML)
Languages & Development Tools
Messaging & Collaboration
Networking, Protocols & Data Formats
Reusing Browser Technology
Security & Cryptography
Server Technologies
Streaming & Interactive Media
Web Content Management
Workshop Index
Tools & Samples Home
Tools
Samples, Headers, Libs
Images
Sounds
Style Sheets
Web Fonts
Training Home
SBN Live Seminars
SBN Live Chats
Courses
Peer Support
CD-ROM Training
Books & Training Kits
Certification
SBN Home
New to SBN?
What's New on SBN
Site Map
Site Search
Glossary
Write Us
About This Site