var list = document.getElementById("myList");
EventUtil.addHandler(list,"click",function(event){
event = EventUtil.getEvent(event);
var target = EventUtil.getTarget(event);
switch(target.id){
case"doSomething":
document.title = "I change the document's title";
break;
case"goSomewhere":
loaction.href = "https://zhidao.baidu.com/question/267743089103468925.html?qbl=relate_question_0&word=js%CA%C2%BC%FE%CE%AF%C5%C9"
break;
case"sayHi":
alert("Hello World!!!");
break;
}
})
對於事件委託這一塊一直不是很理解,說是用到了事件冒泡,但是事件委託綁定的不是dom樹種最高層次上添加處理程序,怎麼事件冒泡的它的子元素,求大佬解答
相关分类