点击隐藏自身

//点击之后隐藏自己兼容写法
function addEvent(ele,event,listener) {
        try{
            ele.addEventListener(event,listener,false)
        }catch (e){
            try{
                ele.attachEvent(event,listener);
            }catch (e){
                ele["on"+event] = listener;
            }
        }
    }
    addEvent(btn,"click",function (e) {
        document.getElementById('btn').remove();
    })

  

posted @ 2017-05-25 11:32  武侯668  阅读(206)  评论(0编辑  收藏  举报