addEventListener 方法与 on 事件的区别

黄琦雲 at 
on 事件 Javascript 中可以对一些页面的事件设定触发值,例如常用的点击 onclick,鼠标移动 onmousemove,或者移动端屏幕点击 ontouchstart,其它类似的还有 onmousedown, onmouseup, onchange, onfocus, onmouseenter, ontouchmove, ontouchend 等等,可以对其设定值来实现事件触发后执行的操作,例如:Click me 点击后就会弹出提示框,也可以这样写:Click me 这样也能实现同样效果,只是它的值变成了一个匿名函数。addEventListener()方法这个方法设定一个事件监听……