mozilla
您的搜尋結果

    EventTarget

    This translation is incomplete. Please help translate this article from English.

    EventTarget 由可以接收事件和監聽的物件實現的接口

    Element, document, 和 window 為最常見的事件目標, 但是其他的物件也可以成為事件目標, 例如 XMLHttpRequest, AudioNode, AudioContext, 還有其他的物件.

    許多事件的目標 ( elements, documents, and windows) 也支持設置 event handlers 藉由... 特性和屬性.

    方法

    EventTarget.addEventListener()
    註冊對EventTarget的事件監聽
    EventTarget.removeEventListener()
    移除對EventTarget的事件監聽
    EventTarget.dispatchEvent()
    對EventTarget調度事件
    .

    技術文件

    Specification Status Comment
    DOM
    The definition of 'EventTarget' in that specification.
    Living Standard No change.
    Document Object Model (DOM) Level 3 Events Specification
    The definition of 'EventTarget' in that specification.
    Working Draft A few parameters are now optional (listener), or accepts the null value (useCapture).
    Document Object Model (DOM) Level 2 Events Specification
    The definition of 'EventTarget' in that specification.
    Recommendation Initial definition.

    瀏覽器相容性

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
    Basic support 1.0 1.0 (1.7 or earlier) 9.0 7 1.0
    Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
    Basic support 1.0 1.0 (1) 9.0 6.0 1.0

    Mozilla chrome 瀏覽器的其他方法

    Mozilla extensions for use by JS-implemented event targets to implement on* properties. See also WebIDL bindings.

    • void setEventHandler(DOMString type, EventHandler handler)
    • EventHandler getEventHandler(DOMString type)

    參見

    Document Tags and Contributors

    Contributors to this page: alk03073135, teoli
    最近更新: alk03073135,