我的事件处理程序里有以下代码:
if (document.body.attachEvent)
document.body.attachEvent("onclick", decideColorSelectorOnOff);
else
document.body.addEventListener("click", decideColorSelectorOnOff, false);
if (window.event) {
window.event.cancelBubble = true;
}
else {
return this.cancelBubble.caller.arguments[0].cancelBubble = true;
}
我的意思就是在本次点击事件中不引发body.click(也就是decideColorSelectorOnOff),在后续的点击中才引发,可是为什么它还是会执行到decideColorSelectorOnOff呢?
//取消事件冒泡
event.stopPropagation();