doc: create event object section

This commit is contained in:
Leon Xu committed 2021-08-31 15:58:21 -07:00
1 parent 928a325fb3
commit bbe7970669
1 file changed
+12 -1
+12 -1
View File
@@ -134,4 +134,15 @@ text"> <Go!>
![多个](/images/Event-Listener-with-Multiple-Events.png)
## 删除EventListener
![删除EventListener](/images/Event-Listener-with-Multiple-Events.png)
![删除EventListener](/images/Event-Listener-with-Multiple-Events.png)
## 事件对象
事件处理函数可以附加到对象(窗口、DOM元素等)。
```javascript
source.addEventListener("click", responseFunction);
function responseFunction(e) {
// we can access the click Event object here!
}
```
当事件发生时,将创建一个event对象并传递给事件侦听器。你可以"catch"此事件对象作为可选参数,以获取有关该事件的更多信息。