Skip to main content

Events

https://developer.mozilla.org/zh-CN/docs/Web/Events

事件参考

发送DOM事件是为了将发生的相关事情通知代码。每个事件都是继承自Event 接口的对象,可以包括自定义的成员属性及函数用于获取事件发生时相关的更多信息。事件可以表示任何从基本的用户交互、到发生在渲染模型自动通知的任何事情。

本文提供了一个可以发送的事件的列表;

一些是官方标准中的标准事件,

另一些则是在特定浏览器内部使用的事件;

例如,列出的 Mozilla 特定事件,使附加组件可以借助它们与浏览器进行交互。

最常见的类别

资源事件

事件名称何时触发
error资源加载失败时。
abort正在加载资源已经被中止时。
load资源及其相关资源已完成加载。
beforeunloadwindow,document 及其资源即将被卸载。
unload文档或一个依赖资源正在被卸载。

网络事件

事件名称何时触发
online浏览器已获得网络访问。
offline浏览器已失去网络访问。

焦点事件

事件名称何时触发
focus元素获得焦点(不会冒泡)。
blur元素失去焦点(不会冒泡)。

WebSocket 事件

事件名称何时触发
openWebSocket 连接已建立。
message通过 WebSocket 接收到一条消息。
errorWebSocket 连接异常被关闭(比如有些数据无法发送)。
closeWebSocket 连接已关闭。

会话历史事件

事件名称何时触发
pagehideA session history entry is being traversed from.
pageshowA session history entry is being traversed to.
popstateA session history entry is being navigated to (in certain cases).

CSS 动画事件

事件名称何时触发
animationstart某个 CSS 动画开始时触发。
animationend某个 CSS 动画完成时触发。
animationiteration某个 CSS 动画完成后重新开始时触发。

CSS 过渡事件

事件名称何时触发
transitionstartA CSS transition has actually started (fired after any delay).
transitioncancelCSS过渡被取消
transitionendCSS过渡已经完成
transitionrunA CSS transition has begun running (fired before any delay starts).

表单事件

事件名称何时触发
reset点击重置按钮时
submit点击提交按钮

打印事件

时间名称何时触发
beforeprint打印机已经就绪时触发
afterprint打印机关闭时触发

文本写作事件

Event NameFired When
compositionstartThe composition of a passage of text is prepared (similar to keydown for a keyboard input, but works with other inputs such as speech recognition).
compositionupdateA character is added to a passage of text being composed.
compositionendThe composition of a passage of text has been completed or canceled.

视图事件

Event NameFired When
fullscreenchangeAn element was turned to fullscreen mode or back to normal mode.
fullscreenerrorIt was impossible to switch to fullscreen mode for technical reasons or because the permission was denied.
resizeThe document view has been resized.
scrollThe document view or an element has been scrolled.

剪贴板事件

Event NameFired When
cut已经剪贴选中的文本内容并且复制到了剪贴板。
copy已经把选中的文本内容复制到了剪贴板。
paste从剪贴板复制的文本内容被粘贴。

键盘事件

Event NameFired When
keydown按下任意按键。
keypress除 Shift、Fn、CapsLock 外的任意键被按住。(连续触发。)
keyup释放任意按键。

鼠标事件

Event NameFired When
auxclickA pointing device button (ANY non-primary button) has been pressed and released on an element.
click在元素上按下并释放任意鼠标按键。
contextmenu右键点击(在右键菜单显示前触发)。
dblclick在元素上双击鼠标按钮。
mousedown在元素上按下任意鼠标按钮。
mouseenter指针移到有事件监听的元素内。
mouseleave指针移出元素范围外(不冒泡)。
mousemove指针在元素内移动时持续触发。
mouseover指针移到有事件监听的元素或者它的子元素内。
mouseout指针移出元素,或者移到它的子元素上。
mouseup在元素上释放任意鼠标按键。
pointerlockchange鼠标被锁定或者解除锁定发生时。
pointerlockerror可能因为一些技术的原因鼠标锁定被禁止时。
select有文本被选中。
wheel滚轮向任意方向滚动。

拖放事件

Event NameFired When
drag正在拖动元素或文本选区(在此过程中持续触发,每 350ms 触发一次)
dragend拖放操作结束。(松开鼠标按钮或按下 Esc 键)
dragenter被拖动的元素或文本选区移入有效释放目标区
dragstart用户开始拖动HTML元素或选中的文本
dragleave被拖动的元素或文本选区移出有效释放目标区
dragover被拖动的元素或文本选区正在有效释放目标上被拖动 (在此过程中持续触发,每350ms触发一次)
drop元素在有效释放目标区上释放

媒体事件

Event NameFired When
audioprocessThe input buffer of a ScriptProcessorNode is ready to be processed.
canplayThe browser can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content.
canplaythroughThe browser estimates it can play the media up to its end without stopping for content buffering.
completeThe rendering of an OfflineAudioContext is terminated.
durationchangeThe duration attribute has been updated.
emptiedThe media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it.
endedPlayback has stopped because the end of the media was reached.
loadeddataThe first frame of the media has finished loading.
loadedmetadataThe metadata has been loaded.
pausePlayback has been paused.
playPlayback has begun.
playingPlayback is ready to start after having been paused or delayed due to lack of data.
ratechangeThe playback rate has changed.
seekedA seek operation completed.
seekingA seek operation began.
stalledThe user agent is trying to fetch media data, but data is unexpectedly not forthcoming.
suspendMedia data loading has been suspended.
timeupdateThe time indicated by the currentTime attribute has been updated.
volumechangeThe volume has changed.
waitingPlayback has stopped because of a temporary lack of data.

进度事件

Event NameFired When
abortProgression has been terminated (not due to an error).
errorProgression has failed.
loadProgression has been successful.
loadendProgress has stopped (after "error", "abort" or "load" have been dispatched).
loadstartProgress has begun.
progressIn progress.
timeoutProgression is terminated due to preset time expiring.

存储事件

change (see Non-standard events)

storage

更新事件

checking
downloading
error
noupdate
obsolete
updateready

值变化事件

broadcast
CheckboxStateChange
hashchange
input
RadioStateChange
readystatechange
ValueChange

未分类的事件

invalid
message
message
open
show

不常见和非标准事件

Abortable Fetch events

Event nameFired when
abortA DOM request is aborted, i.e. using AbortController.abort().

WebVR events

Event nameFired when
vrdisplayactivateWhen a VR display is able to be presented to, for example if an HMD has been moved to bring it out of standby, or woken up by being put on.
vrdisplayblurwhen presentation to a VRDisplay has been paused for some reason by the browser, OS, or VR hardware — for example, while the user is interacting with a system menu or browser, to prevent tracking or loss of experience.
vrdisplayconnectwhen a compatible VRDisplay is connected to the computer.
vrdisplaydeactivateWhen a VRDisplay can no longer be presented to, for example if an HMD has gone into standby or sleep mode due to a period of inactivity.
vrdisplaydisconnectWhen a compatible VRDisplay is disconnected from the computer.
vrdisplayfocusWhen presentation to a VRDisplay has resumed after being blurred.
vrdisplaypresentchangeThe presenting state of a VRDisplay changes — i.e. goes from presenting to not presenting, or vice versa.

SVG 事件

SVGAbort
SVGError
SVGLoad
SVGResize
SVGScroll
SVGUnload
SVGZoom

数据库事件

abort
blocked
complete
error
success
upgradeneeded
versionchange

脚本事件

afterscriptexecute
beforescriptexecute

菜单事件

DOMMenuItemActive
DOMMenuItemInactive

窗口事件

close

弹出事件

popuphidden
popuphiding
popupshowing
popupshown

Tab 事件

visibilitychange

电池事件

chargingchange
chargingtimechange
dischargingtimechange
levelchange

呼叫事件

alerting
busy
callschanged
cfstatechange
connected
connecting
dialing
disconnected
disconnecting
error
held`, `holding
incoming
resuming
statechange
voicechange

传感器事件

compassneedscalibration
devicemotion
deviceorientation
orientationchange

智能卡事件

icccardlockerror
iccinfochange
smartcard-insert
smartcard-remove
stkcommand
stksessionend
cardstatechange

短信和USSD事件

delivered
received
sent
ussdreceived

帧事件

mozbrowserclose
mozbrowsercontextmenu
mozbrowsererror
mozbrowsericonchange
mozbrowserlocationchange
mozbrowserloadend
mozbrowserloadstart
mozbrowseropenwindow
mozbrowsersecuritychange
mozbrowsershowmodalprompt
mozbrowsertitlechange

DOM变异事件

DOMAttributeNameChanged
DOMAttrModified
DOMCharacterDataModified
DOMContentLoaded
DOMElementNameChanged
DOMNodeInserted
DOMNodeInsertedIntoDocument
DOMNodeRemoved
DOMNodeRemovedFromDocument
DOMSubtreeModified

触摸事件

touchcancel
touchend
touchmove
touchstart

指针事件

pointerover
pointerenter
pointerdown
pointermove
pointerup
pointercancel
pointerout
pointerleave
gotpointercapture
lostpointercapture

标准事件

这些事件在官方Web规范中定义,并且应在各个浏览器中通用。 每个事件都和代表事件接收方的对象(由此您可以查到每个事件提供的数据),定义这个事件的标准或标准链接会一起列出。

事件名称事件类型规范触发时机...
abortUIEventDOM L3资源载入已被中止
abortProgressEventProgressandXMLHttpRequestProgress被终止(不是error造成的)
abortEventIndexedDB事务已被中止
afterprintEventHTML5相关文档已开始打印或打印预览已被关闭
animationcancelAnimationEventCSS AnimationsA CSS animation has aborted.
animationendAnimationEventCSS Animations完成一个CSS 动画
animationiterationAnimationEventCSS Animations重复播放一个CSS 动画
animationstartAnimationEventCSS Animations一个 CSS 动画已开始
appinstalledEventWeb App ManifestA web application is successfully installed as a progressive web app.
audioprocessAudioProcessingEventWeb Audio API audioprocess一个ScriptProcessorNode 的输入缓冲区可处理
audioendEventWeb Speech API用户代理捕捉到用以语音识别的音频
audiostartEventWeb Speech API用户代理开始捕捉用以语音识别的音频
beforeprintEventHTML5相关文档将要开始打印或准备打印预览
beforeunloadBeforeUnloadEventHTML5即将卸载 window,document 及其资源
beginEventTimeEventSVGA SMIL animation element begins.
blockedIndexedDBAn open connection to a database is blocking a versionchange transaction on the same database.
blurFocusEventDOM L3An element has lost focus (does not bubble).
boundarySpeechSynthesisEventWeb Speech APIThe spoken utterance reaches a word or sentence boundary
canplayEventHTML5 mediaThe user agent can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content.
canplaythroughEventHTML5 mediaThe user agent can play the media up to its end without having to stop for further buffering of content.
changeEventDOM L2, HTML5The change event is fired for ](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/input), [, and `` elements when a change to the element's value is committed by the user.
chargingchangeEventBattery statusThe battery begins or stops charging.
chargingtimechangeEventBattery statusThe chargingTime attribute has been updated.
clickMouseEventDOM L3A pointing device button has been pressed and released on an element.
closeEventWebSocketA WebSocket connection has been closed.
completeIndexedDBA transaction successfully completed.
completeOfflineAudioCompletionEventWeb Audio API OfflineAudioCompletionEventThe rendering of an OfflineAudioContext is terminated.
compositionendCompositionEventDOM L3The composition of a passage of text has been completed or canceled.
compositionstartCompositionEventDOM L3The composition of a passage of text is prepared (similar to keydown for a keyboard input, but works with other inputs such as speech recognition).
compositionupdateCompositionEventDOM L3A character is added to a passage of text being composed.
contextmenuMouseEventHTML5The right button of the mouse is clicked (before the context menu is displayed).
copyClipboardEventClipboardThe text selection has been added to the clipboard.
cutClipboardEventClipboardThe text selection has been removed from the document and added to the clipboard.
dblclickMouseEventDOM L3A pointing device button is clicked twice on an element.
devicechangeEventMedia Capture and StreamsA media device such as a camera, microphone, or speaker is connected or removed from the system.
devicemotionDeviceMotionEventDevice Orientation EventsFresh data is available from a motion sensor.
deviceorientationDeviceOrientationEventDevice Orientation EventsFresh data is available from an orientation sensor.
dischargingtimechangeEventBattery statusThe dischargingTime attribute has been updated.
DOMActivateUIEventDOM L3A button, link or state changing element is activated (use click instead).
DOMAttributeNameChangedMutationNameEventDOM L3 RemovedThe name of an attribute changed (use mutation observers instead).
DOMAttrModifiedMutationEventDOM L3The value of an attribute has been modified (use mutation observers instead).
DOMCharacterDataModifiedMutationEventDOM L3A text or another CharacterData has changed (use mutation observers instead).
DOMContentLoadedEventHTML5The document has finished loading (but not its dependent resources).
DOMElementNameChangedMutationNameEventDOM L3 RemovedThe name of an element changed (use mutation observers instead).
DOMFocusInFocusEventDOM L3An element has received focus (use focus or focusin instead).
DOMFocusOutFocusEventDOM L3An element has lost focus (use blur or focusout instead).
DOMNodeInsertedMutationEventDOM L3A node has been added as a child of another node (use mutation observers instead).
DOMNodeInsertedIntoDocumentMutationEventDOM L3A node has been inserted into the document (use mutation observers instead).
DOMNodeRemovedMutationEventDOM L3A node has been removed from its parent node (use mutation observers instead).
DOMNodeRemovedFromDocumentMutationEventDOM L3A node has been removed from the document (use mutation observers instead).
DOMSubtreeModifiedMutationEventDOM L3A change happened in the document (use mutation observers instead).
dragDragEventHTML5An element or text selection is being dragged (every 350ms).
dragendDragEventHTML5A drag operation is being ended (by releasing a mouse button or hitting the escape key).
dragenterDragEventHTML5A dragged element or text selection enters a valid drop target.
dragleaveDragEventHTML5A dragged element or text selection leaves a valid drop target.
dragoverDragEventHTML5An element or text selection is being dragged over a valid drop target (every 350ms).
dragstartDragEventHTML5The user starts dragging an element or text selection.
dropDragEventHTML5An element is dropped on a valid drop target.
durationchangeEventHTML5 mediaThe duration attribute has been updated.
emptiedEventHTML5 mediaThe media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it.
endEventWeb Speech APIThe speech recognition service has disconnected.
endSpeechSynthesisEventWeb Speech APIThe utterance has finished being spoken.
endedEventHTML5 mediaPlayback has stopped because the end of the media was reached.
endedEventWeb Audio APIPlayback has stopped because the end of the media was reached.
endEventTimeEventSVGA SMIL animation element ends.
errorUIEventDOM L3A resource failed to load.
errorProgressEventProgress and XMLHttpRequestProgression has failed.
errorEventWebSocketA WebSocket connection has been closed with prejudice (some data couldn't be sent for example).
errorEventServer Sent EventsAn event source connection has been failed.
errorEventIndexedDBA request caused an error and failed.
errorEventWeb Speech APIA speech recognition error occurs.
errorSpeechSynthesisErrorEventWeb Speech APIAn error occurs that prevents the utterance from being successfully spoken.
focusFocusEventDOM L3An element has received focus (does not bubble).
focusinFocusEventDOM L3An element is about to receive focus (bubbles).
focusoutFocusEventDOM L3An element is about to lose focus (bubbles).
fullscreenchangeEventFull ScreenAn element was turned to fullscreen mode or back to normal mode.
fullscreenerrorEventFull ScreenIt was impossible to switch to fullscreen mode for technical reasons or because the permission was denied.
gamepadconnectedGamepadEventGamepadA gamepad has been connected.
gamepaddisconnectedGamepadEventGamepadA gamepad has been disconnected.
gotpointercapturePointerEventPointer EventsElement receives pointer capture.
hashchangeHashChangeEventHTML5The fragment identifier of the URL has changed (the part of the URL after the #).
lostpointercapturePointerEventPointer EventsElement lost pointer capture.
inputEventHTML5The value of an element changes or the content of an element with the attribute contenteditable is modified.
invalidEventHTML5A submittable element has been checked and doesn't satisfy its constraints.
keydownKeyboardEventDOM L3A key is pressed down.
keypressKeyboardEventDOM L3A key is pressed down and that key normally produces a character value (use input instead).
keyupKeyboardEventDOM L3A key is released.
languagechangeEventHTML 5.1 NavigatorLanguage.languagesThe user's preferred languages have changed.
levelchangeEventBattery statusThe level attribute has been updated.
loadUIEventDOM L3A resource and its dependent resources have finished loading.
loadProgressEventProgress and XMLHttpRequestProgression has been successful.
loadeddataEventHTML5 mediaThe first frame of the media has finished loading.
loadedmetadataEventHTML5 mediaThe metadata has been loaded.
loadendProgressEventProgress and XMLHttpRequestProgress has stopped (after "error", "abort" or "load" have been dispatched).
loadstartProgressEventProgress and XMLHttpRequestProgress has begun.
markSpeechSynthesisEventWeb Speech APIThe spoken utterance reaches a named SSML "mark" tag.
messageMessageEventWebSocketA message is received through a WebSocket.
messageMessageEventWeb WorkersA message is received from a Web Worker.
messageMessageEventWeb MessagingA message is received from a child (i)frame or a parent window.
messageMessageEventServer Sent EventsA message is received through an event source.
messageerrorMessageEventMessagePort, Web Workers, Broadcast Channel, WindowA message error is raised when a message is received by an object.
messageServiceWorkerMessageEvent or ExtendableMessageEvent, depending on context.Service WorkersA message is received from a service worker, or a message is received in a service worker from another context.
mousedownMouseEventDOM L3A pointing device button (usually a mouse) is pressed on an element.
mouseenterMouseEventDOM L3A pointing device is moved onto the element that has the listener attached.
mouseleaveMouseEventDOM L3A pointing device is moved off the element that has the listener attached.
mousemoveMouseEventDOM L3A pointing device is moved over an element.
mouseoutMouseEventDOM L3A pointing device is moved off the element that has the listener attached or off one of its children.
mouseoverMouseEventDOM L3A pointing device is moved onto the element that has the listener attached or onto one of its children.
mouseupMouseEventDOM L3A pointing device button is released over an element.
nomatchSpeechRecognitionEventWeb Speech APIThe speech recognition service returns a final result with no significant recognition.
notificationclickNotificationEventNotifications API onnotificationclickA system notification spawned by ServiceWorkerRegistration.showNotification() has been clicked.
offlineEventHTML5 offlineThe browser has lost access to the network.
onlineEventHTML5 offlineThe browser has gained access to the network (but particular websites might be unreachable).
openEventWebSocketA WebSocket connection has been established.
openEventServer Sent EventsAn event source connection has been established.
orientationchangeEventScreen OrientationThe orientation of the device (portrait/landscape) has changed
pagehidePageTransitionEventHTML5A session history entry is being traversed from.
pageshowPageTransitionEventHTML5A session history entry is being traversed to.
pasteClipboardEventClipboardData has been transferred from the system clipboard to the document.
pauseEventHTML5 mediaPlayback has been paused.
pauseSpeechSynthesisEventWeb Speech APIThe utterance is paused part way through.
pointercancelPointerEventPointer EventsThe pointer is unlikely to produce any more events.
pointerdownPointerEventPointer EventsThe pointer enters the active buttons state.
pointerenterPointerEventPointer EventsPointing device is moved inside the hit-testing boundary.
pointerleavePointerEventPointer EventsPointing device is moved out of the hit-testing boundary.
pointerlockchangeEventPointer LockThe pointer was locked or released.
pointerlockerrorEventPointer LockIt was impossible to lock the pointer for technical reasons or because the permission was denied.
pointermovePointerEventPointer EventsThe pointer changed coordinates.
pointeroutPointerEventPointer EventsThe pointing device moved out of hit-testing boundary or leaves detectable hover range.
pointeroverPointerEventPointer EventsThe pointing device is moved into the hit-testing boundary.
pointerupPointerEventPointer EventsThe pointer leaves the active buttons state.
playEventHTML5 mediaPlayback has begun.
playingEventHTML5 mediaPlayback is ready to start after having been paused or delayed due to lack of data.
popstatePopStateEventHTML5A session history entry is being navigated to (in certain cases).
progressProgressEventProgress and XMLHttpRequestIn progress.
pushPushEventPush APIA Service Worker has received a push message.
pushsubscriptionchangePushEventPush APIA PushSubscription has expired.
ratechangeEventHTML5 mediaThe playback rate has changed.
readystatechangeEventHTML5 and XMLHttpRequestThe readyState attribute of a document has changed.
repeatEventTimeEventSVGA SMIL animation element is repeated.
resetEventDOM L2, HTML5A form is reset.
resizeUIEventDOM L3The document view has been resized.
resourcetimingbufferfullPerformanceResource TimingThe browser's resource timing buffer is full.
resultSpeechRecognitionEventWeb Speech APIThe speech recognition service returns a result — a word or phrase has been positively recognized and this has been communicated back to the app.
resumeSpeechSynthesisEventWeb Speech APIA paused utterance is resumed.
scrollUIEventDOM L3The document view or an element has been scrolled.
seekedEventHTML5 mediaA seek operation completed.
seekingEventHTML5 mediaA seek operation began.
selectUIEventDOM L3Some text is being selected.
selectstartEventSelection APIA selection just started.
selectionchangeEventSelection APIThe selection in the document has been changed.
showMouseEventHTML5A contextmenu event was fired on/bubbled to an element that has a contextmenu attribute
slotchangeEventDOMThe node contents of a HTMLSlotElement (``) have changed.
soundendEventWeb Speech APIAny sound — recognisable speech or not — has stopped being detected.
soundstartEventWeb Speech APIAny sound — recognisable speech or not — has been detected.
speechendEventWeb Speech APISpeech recognised by the speech recognition service has stopped being detected.
speechstartEventWeb Speech APISound that is recognised by the speech recognition service as speech has been detected.
stalledEventHTML5 mediaThe user agent is trying to fetch media data, but data is unexpectedly not forthcoming.
startEventWeb Speech APIThe speech recognition service has begun listening to incoming audio with intent to recognize grammars associated with the current SpeechRecognition.
startSpeechSynthesisEventWeb Speech APIThe utterance has begun to be spoken.
storageStorageEventWeb StorageA storage area (localStorage or sessionStorage) has changed.
submitEventDOM L2, HTML5A form is submitted.
successEventIndexedDBA request successfully completed.
suspendEventHTML5 mediaMedia data loading has been suspended.
SVGAbortSVGEventSVGPage loading has been stopped before the SVG was loaded.
SVGErrorSVGEventSVGAn error has occurred before the SVG was loaded.
SVGLoadSVGEventSVGAn SVG document has been loaded and parsed.
SVGResizeSVGEventSVGAn SVG document is being resized.
SVGScrollSVGEventSVGAn SVG document is being scrolled.
SVGUnloadSVGEventSVGAn SVG document has been removed from a window or frame.
SVGZoomSVGZoomEventSVGAn SVG document is being zoomed.
timeoutProgressEventXMLHttpRequest
timeupdateEventHTML5 mediaThe time indicated by the currentTime attribute has been updated.
touchcancelTouchEventTouch EventsA touch point has been disrupted in an implementation-specific manners (too many touch points for example).
touchendTouchEventTouch EventsA touch point is removed from the touch surface.
touchmoveTouchEventTouch EventsA touch point is moved along the touch surface.
touchstartTouchEventTouch EventsA touch point is placed on the touch surface.
transitionendTransitionEventCSS TransitionsA CSS transition has completed.
unloadUIEventDOM L3The document or a dependent resource is being unloaded.
upgradeneededIndexedDBAn attempt was made to open a database with a version number higher than its current version. A versionchange transaction has been created.
userproximityUserProximityEventProximity SensorFresh data is available from a proximity sensor (indicates whether the nearby object is near the device or not).
voiceschangedEventWeb Speech APIThe list of SpeechSynthesisVoice objects that would be returned by the SpeechSynthesis.getVoices() method has changed (when the voiceschanged event fires.)
versionchangeIndexedDBA versionchange transaction completed.
visibilitychangeEventPage visibilityThe content of a tab has become visible or has been hidden.
volumechangeEventHTML5 mediaThe volume has changed.
waitingEventHTML5 mediaPlayback has stopped because of a temporary lack of data.
wheelWheelEventDOM L3A wheel button of a pointing device is rotated in any direction.

非标准事件

Event NameEvent TypeSpecificationFired when...
afterscriptexecuteEventMozilla SpecificA script has been executed.
beforescriptexecuteEventMozilla SpecificA script is about to be executed.
beforeinstallpromptEventChrome specificA user is prompted to save a web site to a home screen on mobile.
cardstatechangeFirefox OS specificThe MozMobileConnection.cardState property changes value.
changeDeviceStorageChangeEventFirefox OS specificThis event is triggered each time a file is created, modified or deleted on a given storage area.
connectionInfoUpdateFirefox OS specificThe informations about the signal strength and the link speed have been updated.
cfstatechangeFirefox OS specificThe call forwarding state changes.
datachangeFirefox OS specificThe MozMobileConnection.data object changes values.
dataerrorFirefox OS specificThe MozMobileConnection.data object receive an error from the RIL.
DOMMouseScrollMozilla specificThe wheel button of a pointing device is rotated (detail attribute is a number of lines). (use wheel instead)
dragdropDragEventMozilla specificAn element is dropped (use drop instead).
dragexitDragEventMozilla specificA drag operation is being ended(use dragend instead).
draggestureDragEventMozilla specificThe user starts dragging an element or text selection (use dragstart instead).
icccardlockerrorFirefox OS specificthe MozMobileConnection.unlockCardLock() or MozMobileConnection.setCardLock() methods fails.
iccinfochangeFirefox OS specificThe MozMobileConnection.iccInfo object changes.
localizedMozilla SpecificThe page has been localized using data-l10n-* attributes.
mousewheelIE inventedThe wheel button of a pointing device is rotated.
MozAudioAvailableEventMozilla specificThe audio buffer is full and the corresponding raw samples are available.
MozBeforeResizeMozilla specificA window is about to be resized.
mozbrowseractivitydoneFirefox OS Browser API-specificSent when some activity has been completed (complete description TBD.)
mozbrowserasyncscrollFirefox OS Browser API-specificSent when the scroll position within a browser `` changes.
mozbrowseraudioplaybackchangeFirefox OS Browser API-specificSent when audio starts or stops playing within the browser `` content.
mozbrowsercaretstatechangedFirefox OS Browser API-specificSent when the text selected inside the browser `` content changes.
mozbrowsercloseFirefox OS Browser API-specificSent when window.close() is called within a browser ``.
mozbrowsercontextmenuFirefox OS Browser API-specificSent when a browser `` try to open a context menu.
mozbrowserdocumentfirstpaintFirefox OS Browser API-specificSent when a new paint occurs on any document in the browser ``.
mozbrowsererrorFirefox OS Browser API-specificSent when an error occured while trying to load a content within a browser iframe
mozbrowserfindchangeFirefox OS Browser API-specificSent when a search operation is performed on the browser `` content (see HTMLIFrameElement search methods.)
mozbrowserfirstpaintFirefox OS Browser API-specificSent when the `` paints content for the first time (this doesn't include the initial paint from about:blank.)
mozbrowsericonchangeFirefox OS Browser API-specificSent when the favicon of a browser iframe changes.
mozbrowserlocationchangeFirefox OS Browser API-specificSent when an browser iframe's location changes.
mozbrowserloadendFirefox OS Browser API-specificSent when the browser iframe has finished loading all its assets.
mozbrowserloadstartFirefox OS Browser API-specificSent when the browser iframe starts to load a new page.
mozbrowsermanifestchangeFirefox OS Browser API-specificSent when a the path to the app manifest changes, in the case of a browser `` with an open web app embedded in it.
mozbrowsermetachangeFirefox OS Browser API-specificSent when a ](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/meta) elelment is added to, removed from or changed in the browser ['s content.
mozbrowseropensearchFirefox OS Browser API-specificSent when a link to a search engine is found.
mozbrowseropentabFirefox OS Browser API-specificSent when a new tab is opened within a browser `` as a result of the user issuing a command to open a link target in a new tab (for example ctrl/cmd + click.)
mozbrowseropenwindowFirefox OS Browser API-specificSent when window.open() is called within a browser iframe.
mozbrowserresizeFirefox OS Browser API-specificSent when the browser ``'s window size has changed.
mozbrowserscrollFirefox OS Browser API-specificSent when the browser `` content scrolls.
mozbrowserscrollareachangedFirefox OS Browser API-specificSent when the available scrolling area in the browser `` changes. This can occur on resize and when the page size changes (while loading for example.)
mozbrowserscrollviewchangeFirefox OS Browser API-specificSent when asynchronous scrolling (i.e. APCZ) starts or stops.
mozbrowsersecuritychangeFirefox OS Browser API-specificSent when the SSL state changes within a browser iframe.
mozbrowserselectionstatechangedFirefox OS Browser API-specificSent when the text selected inside the browser `` content changes. Note that this is deprecated, and newer implementations use mozbrowsercaretstatechanged instead.
mozbrowsershowmodalpromptFirefox OS Browser API-specificSent when alert(), confirm() or prompt() are called within a browser iframe
mozbrowsertitlechangeFirefox OS Browser API-specificSent when the document.title changes within a browser iframe.
mozbrowserusernameandpasswordrequiredFirefox OS Browser API-specificSent when an HTTP authentification is requested.
mozbrowservisibilitychangeFirefox OS Browser API-specificSent when the visibility state of the current browser iframe `` changes, for example due to a call to setVisible().
MozGamepadButtonDownTo be specifiedA gamepad button is pressed down.
MozGamepadButtonUpTo be specifiedA gamepad button is released.
MozMousePixelScrollMozilla specificThe wheel button of a pointing device is rotated (detail attribute is a number of pixels). (use wheel instead)
MozOrientationMozilla specificFresh data is available from an orientation sensor (see deviceorientation).
MozScrolledAreaChangedUIEventMozilla specificThe document view has been scrolled or resized.
moztimechangeMozilla specificThe time of the device has been changed.
MozTouchDownMozilla specificA touch point is placed on the touch surface (use touchstart instead).
MozTouchMoveMozilla specificA touch point is moved along the touch surface (use touchmove instead).
MozTouchUpMozilla specificA touch point is removed from the touch surface (use touchend instead).
alertingCallEventTo be specifiedThe correspondent is being alerted (his/her phone is ringing).
busyCallEventTo be specifiedThe line of the correspondent is busy.
callschangedCallEventTo be specifiedA call has been added or removed from the list of current calls.
onconnected connectedCallEventTo be specifiedA call has been connected.
connectingCallEventTo be specifiedA call is about to connect.
deliveredSMSEventTo be specifiedAn SMS has been successfully delivered.
dialingCallEventTo be specifiedThe number of a correspondent has been dialed.
disabledFirefox OS specificWifi has been disabled on the device.
disconnectedCallEventTo be specifiedA call has been disconnected.
disconnectingCallEventTo be specifiedA call is about to disconnect.
enabledFirefox OS specificWifi has been enabled on the device.
errorCallEventTo be specifiedAn error occurred.
heldCallEventTo be specifiedA call has been held.
holdingCallEventTo be specifiedA call is about to be held.
incomingCallEventTo be specifiedA call is being received.
receivedSMSEventTo be specifiedAn SMS has been received.
resumingCallEventTo be specifiedA call is about to resume.
sentSMSEventTo be specifiedAn SMS has been sent.
statechangeCallEventTo be specifiedThe state of a call has changed.
statuschangeFirefox OS specificThe status of the Wifi connection changed.
overflowUIEventMozilla specificAn element has been overflowed by its content or has been rendered for the first time in this state (only works for elements styled with overflow != visible).
smartcard-insertMozilla specificA smartcard has been inserted.
smartcard-removeMozilla specificA smartcard has been removed.
stkcommandFirefox OS specificThe STK Proactive Command is issued from ICC.
stksessionendFirefox OS specificThe STK Session is terminated by ICC.
touchenterTouchEventTouch Events Removed
touchleaveTouchEventTouch Events Removed
underflowUIEventMozilla specificAn element is no longer overflowed by its content (only works for elements styled with overflow != visible).
uploadprogressProgressEventMozilla SpecificUpload is in progress (see progress).
ussdreceivedFirefox OS specificA new USSD message is received
voicechangeFirefox OS specificThe MozMobileConnection.voice object changes values.
msContentZoomMicrosoft specific
MSManipulationStateChangedMicrosoft specific
MSPointerHoverMicrosoft specific

Mozilla 特定事件

**注意:**这些事件不会暴露给 Web 内容使用,只能在 chrome 内容的上下文中使用。

XUL 事件

Event NameEvent TypeSpecificationFired when...
broadcastXULAn observer noticed a change to the attributes of a watched broadcaster.
CheckboxStateChangeXULThe state of a checkbox has been changed either by a user action or by a script (useful for accessibility).
closeXULThe close button of the window has been clicked.
commandXULAn element has been activated.
commandupdateXULA command update occurred on a commandset element.
DOMMenuItemActiveXULA menu or menuitem has been hovered or highlighted.
DOMMenuItemInactiveXULA menu or menuitem is no longer hovered or highlighted.
popuphiddenPopupEventXULA menupopup, panel or tooltip has been hidden.
popuphidingPopupEventXULA menupopup, panel or tooltip is about to be hidden.
popupshowingPopupEventXULA menupopup, panel or tooltip is about to become visible.
popupshownPopupEventXULA menupopup, panel or tooltip has become visible.
RadioStateChangeXULThe state of a radio has been changed either by a user action or by a script (useful for accessibility).
ValueChangeXULThe value of an element has changed (a progress bar for example, useful for accessibility).

附加组件特定事件

Event NameEvent TypeSpecificationFired when...
MozSwipeGestureAddons specificA touch point is swiped across the touch surface
MozMagnifyGestureStartAddons specificTwo touch points start to move away from each other.
MozMagnifyGestureUpdateAddons specificTwo touch points move away from each other (after a MozMagnifyGestureStart).
MozMagnifyGestureAddons specificTwo touch points moved away from each other (after a sequence of MozMagnifyGestureUpdate).
MozRotateGestureStartAddons specificTwo touch points start to rotate around a point.
MozRotateGestureUpdateAddons specificTwo touch points rotate around a point (after a MozRotateGestureStart).
MozRotateGestureAddons specificTwo touch points rotate around a point (after a sequence of MozRotateGestureUpdate).
MozTapGestureAddons specificTwo touch points are tapped on the touch surface.
MozPressTapGestureAddons specificA "press-tap" gesture happened on the touch surface (first finger down, second finger down, second finger up, first finger up).
MozEdgeUIGestureAddons specificA touch point is swiped across the touch surface to invoke the edge UI (Win8 only).
MozAfterPaintAddons specificContent has been repainted.
DOMPopupBlockedAddons specificA popup has been blocked
DOMWindowCreatedAddons specificA window has been created.
DOMWindowCloseAddons specificA window is about to be closed.
DOMTitleChangedAddons specifcThe title of a window has changed.
DOMLinkAddedAddons specifcA link has been added a document.
DOMLinkRemovedAddons specifcA link has been removed inside from a document.
DOMMetaAddedAddons specificA meta element has been added to a document.
DOMMetaRemovedAddons specificA meta element has been removed from a document.
DOMWillOpenModalDialogAddons specificA modal dialog is about to open.
DOMModalDialogClosedAddons specificA modal dialog has been closed.
DOMAutoCompleteAddons specificThe content of an element has been auto-completed.
DOMFrameContentLoadedAddons specificThe frame has finished loading (but not its dependent resources).
AlertActiveAddons specificA notification element is shown.
AlertCloseAddons specificA notification element is closed.
fullscreenAddons specificBrowser fullscreen mode has been entered or left.
sizemodechangeAddons specificWindow has entered/left fullscreen mode, or has been minimized/unminimized.
MozEnteredDomFullscreenAddons specificDOM fullscreen mode has been entered.
SSWindowClosingAddons specificThe session store will stop tracking this window.
SSTabClosingAddons specificThe session store will stop tracking this tab.
SSTabRestoringAddons specificA tab is about to be restored.
SSTabRestoredAddons specificA tab has been restored.
SSWindowStateReadyAddons specificA window state has switched to "ready".
SSWindowStateBusyAddons specificA window state has switched to "busy".
TabOpenAddons specificA tab has been opened.
TabCloseAddons specificA tab has been closed.
TabSelectAddons specificA tab has been selected.
TabShowAddons specificA tab has been shown.
TabHideAddons specificA tab has been hidden.
TabPinnedAddons specificA tab has been pinned.
TabUnpinnedAddons specificA tab has been unpinned.

开发者工具特定事件

Event NameEvent TypeSpecificationFired when...
CssRuleViewRefresheddevtools specificThe "Rules" view of the style inspector has been updated.
CssRuleViewChangeddevtools specificThe "Rules" view of the style inspector has been changed.
CssRuleViewCSSLinkClickeddevtools specificA link to a CSS file has been clicked in the "Rules" view of the style inspector.

参见