DOM 事件级别
DOM0 element.onclick=function(){}
DOM2 element.addEventListener('click',function(){},false)
DOM3 element.addEventListener('keyup',function(){},false) // 增加事件类型
DOM事件流
- 事件捕获
- 处于目标
- 事件冒泡
![](https://img.haomeiwen.com/i5930683/328be2b18c93d0f3.png)
DOM事件捕获流程
从window开始
![](https://img.haomeiwen.com/i5930683/973f45852b394e2d.png)
Event事件常见应用
event.prventDefault() // 阻止默认事件
event.stopPropagation() //阻止冒泡
event.stopimmediatePropagation() //阻止向上冒泡
event.currentTarget() // 获取绑定事件的对象
event.target() // 获取事件目标
网友评论