--- title: GlobalEventHandlers slug: Web/API/GlobalEventHandlers translation_of: Web/API/GlobalEventHandlers ---
GlobalEventHandlers
描述了一系列web worker的事件接口 {{domxref("HTMLElement")}}, {{domxref("Document")}}, {{domxref("Window")}}, 或 {{domxref("WorkerGlobalScope")}}。这里面的每一个接口都可以添加更多的事件句柄。
Note:GlobalEventHandlers
是一个混入对象(mixin)而不是一个真正的接口,所以无法创建直接基于GlobalEventHandlers
的对象。
除了下面的事件句柄外,此接口不包含任何其他属性。
这些事件定义在 {{domxref("GlobalEventHandlers")}} 中, 并被混入和实现在{{domxref("HTMLElement")}}, {{domxref("Document")}}, {{domxref("Window")}}上,任意html元素、document对象,window对象上均可以使用它提供的属性, 即时是全局的{{domxref("WorkerGlobalScope")}}。
This interface defines no method.
Specification | Status | Comment |
---|---|---|
{{SpecName('Pointer Lock', '#extensions-to-the-document-interface', 'Extension of Document')}} | {{Spec2('Pointer Lock')}} | Adds onpointerlockchange and onpointerlockerror on {{domxref("Document")}}. It is experimentally implemented on GlobalEventHandlers . |
{{SpecName('HTML WHATWG', '#globaleventhandlers', 'GlobalEventHandlers')}} | {{Spec2('HTML WHATWG')}} | No change since the latest snapshot, {{SpecName("HTML5.1")}}. |
{{SpecName('HTML5.1', '#globaleventhandlers', 'GlobalEventHandlers')}} | {{Spec2('HTML5.1')}} | Snapshot of {{SpecName("HTML WHATWG")}}. Added onsort since the {{SpecName("HTML 5")}} snapshot. |
{{SpecName("HTML5 W3C", "#globaleventhandlers", "GlobalEventHandlers")}} | {{Spec2('HTML5 W3C')}} | Snapshot of {{SpecName("HTML WHATWG")}}. Creation of GlobalEventHandlers (properties where on the target before it). |
{{CompatibilityTable}}
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
oncanplay , oncanplaythrough , ondurationchange , onemptied , onended , onloadeddata , onloadedmetadata , onloadstart , onpause , onplay , onplaying , onprogress , onratechange , onseeked , onseeking , onstalled , ontimeupdate , onvolumechange , onwaiting |
{{CompatGeckoDesktop(1.9.1)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
onsuspend |
{{CompatGeckoDesktop(1.9.2)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
ondrag , ondragend , ondragenter , ondragleave , ondragover , ondragstart , ondrop |
{{CompatGeckoDesktop(1.9.1)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
onmouseenter , onmouseleave |
{{CompatGeckoDesktop(10)}} | 30.0 | 5.5 | 17 | {{CompatUnknown}} |
ondragexit |
{{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
oncancel |
{{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
onclose |
{{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
oncuechange |
{{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
ondragexit |
{{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
onmousewheel |
{{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
onsort {{experimental_inline}} |
{{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
onmozfullscreenchange , onmozfullscreenerror {{non-standard_inline}} |
{{CompatVersionUnknown}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
onpointerlockchange , onpointerlockerror |
{{CompatGeckoDesktop(10)}} as onmozpointerlockchange , onmozpointerlockerror |
{{CompatVersionUnknown}} as onwebkitpointerlockchange , onwebkitpointerlockerror |
{{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
onpointercancel , onpointerdown , onpointerup , onpointermove , onpointerout , onpointerover , onpointerenter , onpointerleave , ongotpointercapture , onlostpointercapture |
{{CompatVersionUnknown}} behind the dom.w3c_pointer_events.enabled pref (disabled by default) |
{{CompatNo}} | {{CompatVersionUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
Feature | Firefox Mobile (Gecko) | Android | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
ondrag , ondragend , ondragenter , ondragleave , ondragover , ondragstart , ondrop |
{{CompatGeckoMobile(1.9.1)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
oncanplay , oncanplaythrough , ondurationchange , onemptied , onended , onloadeddata , onloadedmetadata , onloadstart , onpause , onplay , onplaying , onprogress , onratechange , onseeked , onseeking , onstalled , ontimeupdate , onvolumechange , onwaiting |
{{CompatGeckoMobile(1.9.1)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
onmouseenter , onmouseleave |
{{CompatGeckoMobile(10)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
onsuspend |
{{CompatGeckoMobile(1.9.2)}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
ondragexit |
{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
oncancel |
{{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
onclose |
{{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
oncuechange |
{{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
ondragexit |
{{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
onmousewheel |
{{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
onsort |
{{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
onmozfullscreenchange , onmozfullscreenerror {{non-standard_inline}} |
{{CompatVersionUnknown}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
onpointerlockchange , onpointerlockerror |
{{CompatGeckoMobile(10)}} as onmozpointerlockchange , onmozpointerlockerror |
{{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
onpointercancel , onpointerdown , onpointerup , onpointermove , onpointerout , onpointerover , onpointerenter , onpointerleave , ongotpointercapture , onlostpointercapture |
{{CompatVersionUnknown}} behind the dom.w3c_pointer_events.enabled pref (disabled by default) |
{{CompatNo}} | {{CompatUnknown}} | {{CompatNo}} | {{CompatNo}} |