MDN wants to learn about developers like you:



在 概述 中提供了对设计模式的介绍和现代Web浏览器中事件和处理程序的概述。

在 自定义事件 中介绍了如何创建自定义事件、注册监听自定义事件和如何在代码中触发自定义事件


设备可以在Web浏览器运行时触发事件, for example due to a change in its position and orientation in the real world, as discussed partially by the page on orientation coordinate systems and the page on the use of 3D transforms. That is different, but similar, to the change in device vertical orientation. 

The 窗口 in which the browser is displayed which might trigger events, for example, change size if the user maximizes the window or otherwise changes it.

The process loading of a web page might trigger events in response to the completion of different steps in the downloading, parsing, and rendering of the web page for display to the user.

The user interaction with the web page contents might trigger events. The events triggered by user interaction evolved during the early years of browser design and include a complicated system defining the sequence in which events will be called and the manner in which that sequence can be controlled. The different types of user interaction driven events include:

The modification of the web page in structure or content might trigger some events, as is explained in the mutation events page, but the use of these events has been deprecated in favour of the lighter Mutation Observer approach.

The media streams embedded in the HTML documents might trigger some events, as explained in the media events page.

The network requests made by a web page might trigger some events.

There are many other sources of events defined by web browsers for which pages are not yet available in this guide.

Note: This Event Developer Guide needs substantial work. The structure needs to be reorganized and the pages rewritten. Our hope is that everything you need to know about events will go under here.


DOM 事件回调
Web平台提供了多种方式来获取 DOM events 的通知。种常见的风格是:广义 addEventListener() 和一组特定的on-event处理程序。本页重点介绍后者如何工作的细节。
Mutation events
Mutation events provide a mechanism for a web page or an extension to get notified about changes made to the DOM. Use Mutation Observers instead if possible.
Orientation 和 motion 数据解释
Overview of Events and Handlers
Events and event handling provide a core technique in Javascript for reactivity to incidents which occur during the time a web page is kept open by a user, including incidents which occur while a page is being prepared for display, incidents due to user interaction with the content of the web page, incidents related to the device on which the browser is running, or incidents due to many other causes such as media stream playback or animation timing.
创建和触发 events


 此页面的贡献者: NoDocCat, Tankunpeng, Jeremie
 最后编辑者: NoDocCat,