--- title: Event.stopPropagation() slug: Web/API/Event/stopPropagation tags: - API - DOM - Event - Method - NeedsRewrite - Reference translation_of: Web/API/Event/stopPropagation ---
{{APIRef("DOM")}}

{{domxref("Event")}} 介面的 stopPropagation() 方法可阻止當前事件繼續進行捕捉(capturing)及冒泡(bubbling)階段的傳遞。

語法

event.stopPropagation();

範例

請參考範例五:事件傳遞章節中關於此方法與 DOM 事件傳遞的更詳細範例。

規範

Specification Status Comment
{{SpecName("DOM WHATWG", "#dom-event-stoppropagation", "Event.stopPropagation()")}} {{Spec2("DOM WHATWG")}}
{{SpecName("DOM4", "#dom-event-stoppropagation", "Event.stopPropagation()")}} {{Spec2("DOM4")}}
{{SpecName("DOM2 Events", "#Events-Event-stopPropagation", "Event.stopPropagation()")}} {{Spec2("DOM2 Events")}} Initial definition

瀏覽器相容性

{{Compat("api.Event.stopPropagation")}}

參見