--- title: event.cancelBubble slug: orphaned/Web/API/UIEvent/cancelBubble translation_of: Web/API/UIEvent/cancelBubble original_slug: Web/API/UIEvent/cancelBubble ---
{{ ApiRef() }}
{{ Deprecated_header() }} 获取或设置一个布尔值,表明当前事件是否要取消冒泡.
event.cancelBubble = bool; var bool = event.cancelBubble;
bool
的值为true或
false
.
如果一个事件是可冒泡的,则它的cancelBubble
属性的默认值为 false
,代表允许该事件向上冒泡. 将cancelBubble
属性设置为true以后,可以阻止该事件的进一步冒泡行为.
{{ languages( { "pl": "pl/DOM/event.cancelBubble" ,"en": "en/DOM/event.cancelBubble" } ) }}