JS 事件小结

DOM0事件覆盖

    var btn=document.getElementsByTagName('button')[0];
    btn.addEventListener('click',function(){
        console.log('event clicjk');    
    },false);
    btn.onclick=function(){
        console.log('onclick');
    }
    btn.onclick=function(){
        console.log('onclick1');
        //DOM0事件存在覆盖 这样写会覆盖前面DOM0事件  但是不会覆盖DOM2事件
    }

 

posted @ 2014-04-19 10:57  cart55free99  阅读(134)  评论(0编辑  收藏  举报