Event reference
事件為一些有趣事情,發生後會被傳出以通知 code。每個事件被表示為一個根據 Event
所定義的物件,且可能會有額外自訂欄位與(或)函式來描述發生了什麼事。事件可以表示從使用者互動到自動通知等渲染 model 所有的事情。
This article offers a list of events that can be sent; some are standard events defined in official specifications, while others are events used internally by specific browsers; for example, Mozilla-specific events are listed so that add-ons can use them to interact with the browser.no
事件索引
事件類型 | 描述 | 文件 |
---|---|---|
Animation |
Events related to the Web Animation API. Used to respond to changes in animation status (e.g. when an animation starts or ends). |
Animation events fired on
Document ,
Window ,
HTMLElement .
|
Asynchronous data fetching | Events related to the fetching data. |
Events fired on
AbortSignal ,
XMLHttpRequest ,
FileReader .
|
Clipboard |
Events related to the Clipboard API. Used to notify when content is cut, copied, or pasted. |
Events fired on
Document ,
Element ,
Window .
|
Composition |
Events related to composition; entering text "indirectly" (rather than using normal keyboard presses). For example, text entered via a speech to text engine, or using special key combinations that modify keyboard presses to represent new characters in another language. |
Events fired on
Element .
|
CSS transition |
Events related to CSS Transitions. Provides notification events when CSS transitions start, stop, are cancelled, etc. |
Events fired on
Document ,
HTMLElement ,
Window .
|
Database |
Events related to database operations: opening, closing, transactions, errors, etc. |
Events fired on
IDBDatabase ,
IDBOpenDBRequest ,
IDBRequest ,
IDBTransaction .
|
DOM mutation |
Events related to modifications to the Document Object Model (DOM) hierarchy and nodes. |
Warning: Mutation Events are deprecated. Mutation Observers should be used instead. |
Drag'n'drop, Wheel |
Events related to using the HTML Drag and Drop API and wheel events. Drag and Wheel events are derived from mouse events. While they are fired when using mouse wheel or drag/drop, they may also be used with other appropriate hardware. |
Drag events fired on
|
Focus | Events related to elements gaining and losing focus. |
Events fired on
Element ,
Window .
|
Form |
Events related to forms being constructed, reset and submitted. |
Events fired on
HTMLFormElement .
|
Fullscreen |
Events related to the Fullscreen API. Used to notify when the transitioning between full screen and windowed modes, and also of errors occurring during this transition. |
Events fired on
Document ,
Element .
|
Gamepad |
Events related to the Gamepad API. |
Events fired on
Window .
|
Gestures |
Touch events are recommended for implementing gestures. |
Events fired on
In addition there are a number of non-standard gesture events:
|
History |
Events related to the History API. |
Events fired on
Window .
|
HTML element content display management |
Events related to changing the state of a display or textual element. |
Events fired on
HTMLDetailsElement ,
HTMLDialogElement ,
HTMLSlotElement .
|
Inputs |
Events related to HTML input elements e.g.
|
Events fired on
HTMLElement ,
HTMLInputElement .
|
Keyboard |
Events related to using a keyboard. Used to notify when keys are moved up, down, or just pressed. |
Events fired on
Document ,
Element .
|
Loading/unloading documents | Events related to loading and unloading documents. |
|
Manifests |
Events related to installation of progressive web app manifests. |
Events fired on
Window .
|
Media |
Events related to media usage (including the Media Capture and Streams API, Web Audio API, Picture-in-Picture API, etc.). |
Events fired on
ScriptProcessorNode ,
HTMLMediaElement ,
AudioTrackList ,
AudioScheduledSourceNode ,
MediaRecorder ,
MediaStream ,
MediaStreamTrack ,
VideoTrackList ,
HTMLTrackElement ,
OfflineAudioContext ,
TextTrack ,
TextTrackList ,
Element/audio,
Element/video.
|
Messaging |
Events related to a window receiving a message from another browsing context. |
Events fired on
Window .
|
Mouse |
Events related to using a computer mouse. Used to notify when the mouse is clicked, doubleclicked, up and down events, right-click, movement in and out of an element, text selection, etc. Pointer events provide a hardware-agnostic alternative to mouse events. Drag and Wheel events are derived from mouse events. |
Mouse events fired on
Element
|
Network/Connection | Events related to gaining and losing network connection. |
Events fired on
Events fired on
|
Payments |
Events related to the Payment Request API. |
Events fired on
|
Performance |
Events related to High Resolution Time API, Performance Timeline API, Navigation Timing API, User Timing API, and Resource Timing API. |
Events fired on
|
Pointer |
Events related to the Pointer Events API. Provides hardware-agnostic notification from pointing devices including Mouse, Touch, pen/stylus. |
Events fired on
Document ,
HTMLElement .
|
Events related to printing. |
Events fired on
Window .
|
|
Promise rejection |
Events sent to the global script context when any JavaScript promise is rejected. |
Events fired on
Window .
|
Sockets |
Events related to the WebSockets API. |
Events fired on
Websocket .
|
SVG | Events related to SVG images. |
Events fired on
|
Text selection |
Selection API events related to selecting text. |
Event ( |
Touch |
Events related to the Touch Events API. Provides notification events from interacting with a touch sensitive screen (i.e. using a finger or stylus). Not related to the Force Touch API. |
Events fired on
Document ,
Element .
|
Virtual reality |
Events related to the WebXR Device API.
Warning: The
WebVR API (and
associated
|
Events fired on
XRSystem ,
XRSession ,
XRReferenceSpace .
|
RTC (real time communication) |
Events related to the WebRTC API. |
Events fired on
RTCDataChannel ,
RTCDTMFSender ,
RTCIceTransport ,
RTCPeerConnection .
|
Server-sent events |
Events related to the server sent events API. |
Events fired on
EventSource .
|
Speech |
Events related to the Web Speech API. |
Events fired on
SpeechSynthesisUtterance .
|
Workers |
Events related to the Web Workers API, Service Worker API, Broadcast Channel API, and Channel Messaging API. Used to respond to new messages and message sending errors. Service workers can also be notified of other events, including push notifications, users clicking on displayed notifications, that push subscription has been invalidated, deletion of items from the content index, etc. |
Events fired on
ServiceWorkerGlobalScope ,
DedicatedWorkerGlobalScope ,
SharedWorkerGlobalScope ,
WorkerGlobalScope , Worker ,
WorkerGlobalScope ,
BroadcastChannel ,
MessagePort .
|
事件分類
AbortSignal
AudioScheduledSourceNode
AudioTrackList
BroadcastChannel
DedicatedWorkerGlobalScope
Document
- animationcancel 事件
- animationend 事件
- animationiteration 事件
- animationstart 事件
- copy 事件
- cut 事件
- DOMContentLoaded 事件
- dragend 事件
- dragenter 事件
- dragleave 事件
- dragover 事件
- dragstart 事件
- drag 事件
- drop 事件
- fullscreenchange 事件
- fullscreenerror 事件
- gotpointercapture 事件
- keydown 事件
- keypress 事件
- keyup 事件
- lostpointercapture 事件
- paste 事件
- pointercancel 事件
- pointerdown 事件
- pointerenter 事件
- pointerleave 事件
- pointerlockchange 事件
- pointerlockerror 事件
- pointermove 事件
- pointerout 事件
- pointerover 事件
- pointerup 事件
- readystatechange 事件
- scroll 事件
- selectionchange 事件
- touchcancel 事件
- touchend 事件
- touchmove 事件
- touchstart 事件
- transitioncancel 事件
- transitionend 事件
- transitionrun 事件
- transitionstart 事件
- visibilitychange 事件
- wheel 事件
Element
- animationcancel 事件
- animationend 事件
- animationiteration 事件
- animationstart 事件
- afterscriptexecute 事件
- auxclick 事件
- beforescriptexecute 事件
- blur 事件
- click 事件
- compositionend 事件
- compositionstart 事件
- compositionupdate 事件
- contextmenu 事件
- copy 事件
- cut 事件
- dblclick 事件
- DOMActivate 事件
- DOMMouseScroll 事件
- error 事件
- focusin 事件
- focusout 事件
- focus 事件
- fullscreenchange 事件
- fullscreenerror 事件
- gesturechange 事件
- gestureend 事件
- gesturestart 事件
- gotpointercapture 事件
- keydown 事件
- keypress 事件
- keyup 事件
- lostpointercapture 事件
- mousedown 事件
- mouseenter 事件
- mouseleave 事件
- mousemove 事件
- mouseout 事件
- mouseover 事件
- mouseup 事件
- mousewheel 事件
- msContentZoom 事件
- MSGestureChange 事件
- MSGestureEnd 事件
- MSGestureHold 事件
- MSGestureStart 事件
- MSGestureTap 事件
- MSInertiaStart 事件
- MSManipulationStateChanged 事件
- paste 事件
- pointercancel 事件
- pointerdown 事件
- pointerenter 事件
- pointerleave 事件
- pointermove 事件
- pointerout 事件
- pointerover 事件
- pointerup 事件
- scroll 事件
- select 事件
- show 事件
- touchcancel 事件
- touchend 事件
- touchmove 事件
- touchstart 事件
- transitioncancel 事件
- transitionend 事件
- transitionrun 事件
- transitionstart 事件
- webkitmouseforcechanged 事件
- webkitmouseforcedown 事件
- webkitmouseforceup 事件
- webkitmouseforcewillbegin 事件
- wheel 事件
EventSource
FileReader
HTMLCanvasElement
HTMLDetailsElement
HTMLDialogElement
HTMLElement
HTMLFormElement
HTMLInputElement
HTMLMediaElement
HTMLSlotElement
HTMLTrackElement
HTMLVideoElement
IDBDatabase
IDBOpenDBRequest
IDBRequest
IDBTransaction
MediaDevices
MediaRecorder
MediaStream
MediaStreamTrack
MessagePort
OfflineAudioContext
PaymentRequest
PaymentResponse
Performance
PictureInPictureWindow
RTCDataChannel
RTCDtlsTransport
RTCDTMFSender
RTCIceTransport
RTCPeerConnection
ScriptProcessorNode
ServiceWorkerContainer
ServiceWorkerGlobalScope
SharedWorkerGlobalScope
SpeechRecognition
SpeechSynthesis
SpeechSynthesisUtterance
SVGAnimationElement
SVGElement
SVGGraphicsElement
TextTrack
TextTrackList
VideoTrackList
VisualViewport
WebSocket
Window
- afterprint 事件
- animationcancel 事件
- animationend 事件
- animationiteration 事件
- animationstart 事件
- appinstalled 事件
- beforeprint 事件
- beforeunload 事件
- blur 事件
- copy 事件
- cut 事件
- devicemotion 事件
- deviceorientation 事件
- error 事件
- focus 事件
- gamepadconnected 事件
- gamepaddisconnected 事件
- hashchange 事件
- languagechange 事件
- load 事件
- messageerror 事件
- message 事件
- offline 事件
- online 事件
- orientationchange 事件
- pagehide 事件
- pageshow 事件
- paste 事件
- popstate 事件
- rejectionhandled 事件
- resize 事件
- storage 事件
- transitioncancel 事件
- transitionend 事件
- transitionrun 事件
- transitionstart 事件
- unhandledrejection 事件
- unload 事件
- vrdisplayactivate 事件
- vrdisplayblur 事件
- vrdisplayconnect 事件
- vrdisplaydeactivate 事件
- vrdisplaydisconnect 事件
- vrdisplayfocus 事件
- vrdisplaypointerrestricted 事件
- vrdisplaypointerunrestricted 事件
- vrdisplaypresentchange 事件
Worker
WorkerGlobalScope
XMLHttpRequest
XRReferenceSpace
XRSession
XRSystem
規範
Specification |
---|
HTML Standard # events-2 |