IE浏览器监听:浏览器
function attachEvent(string eventFlag, function eventFunc)
eventFlag: 事件名称,但要加上on,如onclick、onmouseover…
eventFunc: 绑定到事件中执行的动做
在事件监听流中能够使用window.event.cacenlBubble=false来阻止事件继续往下流seo
非IE浏览器监听:事件
function addEventListener(string eventFlag, function eventFunc, [bool useCapture=false])
eventFlag : 事件名称,如click、mouseover…
eventFunc: 绑定到事件中执行的动做
useCapture: 指定是否绑定在捕获阶段,true为是捕获阶段,false为冒泡阶段,默认为true
在事件监听流中能够使用event.stopPropagation()来阻止事件继续往下流string
防止冒泡:io
var stopEvent = function(event){ e = event || window.event; if(e.stopPropagation){ e.stopPropagation(); }else { e.cancelBubble = true; } };event