MDN wants to learn about developers like you: https://qsurvey.mozilla.com/s3/MDN-dev-survey

翻譯不完整。請協助 翻譯此英文文件

概述

回傳一個布林值,表示事件的預設行為是否被取消,也就是事件物件是否曾執行 preventDefault() 方法。

註:You should use this instead of the non-standard, deprecated getPreventDefault() method (see bug 691151).

語法

bool = event.defaultPrevented 

範例

 if (e.defaultPrevented) {
   /* the default was prevented */
 }

規範

Specification Status Comment
DOM
The definition of 'Event.defaultPrevented()' in that specification.
Living Standard  
DOM4
The definition of 'Event.defaultPrevented' in that specification.
Recommendation Initial definition.

瀏覽器相容性

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 18 6.0 (6.0) 9.0 11.0 5.0
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? 6.0 (6.0) ? ? 5.0

文件標籤與貢獻者

 此頁面的貢獻者: jackblackevo
 最近更新: jackblackevo,