获取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一样
网友评论