js事件

作者: 祈求者 | 来源:发表于2018-04-03 03:24 被阅读30次

    获取html节点的方法

    document.documentElement
    

    Event对象的常见应用

    1.event.prevenDefault() 阻止默认事件
    2.event.stopPropagation() 阻止冒泡
    3.event.stoplmmediatePropagation()
    4.event.currentTarget
    5.event.target

    自定义事件

    var eve = new Event('custome');
    ev.addEventListener('custome',function(){
      console.log('custome');
    })
    ev.dispatchEvent('custome');
    
    CustomEvent  自定义事件可以指定参数,其他用法和Event一样
    

    相关文章

      网友评论

          本文标题:js事件

          本文链接:https://www.haomeiwen.com/subject/ocgfhftx.html