Events
事件参考
发送DOM事件是为了将发生的相关事情通知代码。每个事件都是继承自Event
接口的对象,可以包括自定义的成员属性及函数用于获取事件发生时相关的更多信息。事件可以表示任何从基本的用户交互、到发生在渲染模型自动通知的任何事情。
本文提供了一个可以发送的事件的列表;
一些是官方标准中的标准事件,
另一些则是在特定浏览器内部使用的事件;
例如,列出的 Mozilla 特定事件,使附加组件可以借助它们与浏览器进行交互。
最常见的类别
资源事件
事件名称 | 何时触发 |
---|---|
error | 资源加载失败时。 |
abort | 正在加载资源已经被中止时。 |
load | 资源及其相关资源已完成加载。 |
beforeunload | window,document 及其资源即将被卸载。 |
unload | 文档或一个依赖资源正在被卸载。 |