//点击之后隐藏自己兼容写法 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(); })