码迷,mamicode.com
首页 > 其他好文 > 详细

事件流

时间:2018-07-16 19:31:13      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:class   Edito   false   bsp   lse   text   时间   button   默认   

1. 现代浏览器的事件流方式: 事件捕获-->目标阶段-->时间冒泡

2. addEventListener

  target.addEventListener(type, handler, usecapture);  //button.addEventListener(‘click‘, updateText, true); | button.addEventListener(‘click‘, updateText, false) ;

  usecapture: boolean. 默认是false, 表示在事件捕获阶段不触发handler; 如果设置为true,那么在捕获阶段就会触发handler. 

        实例: https://codepen.io/ZuoBo/pen/RBrOdz?editors=1010

 

 

事件流

标签:class   Edito   false   bsp   lse   text   时间   button   默认   

原文地址:https://www.cnblogs.com/webKnowledge/p/9319122.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!