为什么div的target.nodeName 显示的input
<div id="box">
<input id="btn1" value="按钮一" type="button" onClick="ss()">
<input id="btn2" value="按钮二" type="button">
<input id="btn3" value="按钮三" type="button">
</div>
<script type="text/javascript">
function ss(event){
alert(event.target.nodeName)
}
function xx(event){
alert(event.target.nodeName)
}
var eventUtil={
//添加句柄
addHandler:function(el,type,handler){
if(el.addEventListener){
el.addEventListener(type,handler,false)
}else if(el.attachEvent){
el.attachEvent('on'+type,handler)
}else{
el['on'+type]=handler//用.点的地方都可以用中括号[]
}
},
//删除句柄
removeHandler:function(el,type,handler){
if(el.removeEventListener){
el.removeEventListener(type,handler,false)
}else if(el.detachEvent){
el.detachEvent('on'+type,handler)
}else{
el['on'+type]=null//用.点的地方都可以用中括号[]
}
}
}
eventUtil.addHandler(btn3,'click',ss)
eventUtil.addHandler(box,'click',xx)
</script>