帮忙看看哪里出错了?显示错误是Uncaught ReferenceError: login_btn is not defined
window.onload=function(){
var login_btn=document.getElementById("login");
var login_box=document.getElementById("login_box");
var close=document.getElementById("close");
}
var eventUtil={
addHandler:function(element,type,handler){
if(element.addEventListener){
element.addEventListener(type,handler,false);
}else if(element.attachEvent){
element.attachEvent("on"+type,handler)
}else{
element["on"+type]=handler;
}
},
}
function showLogin(){
login_box.style.display="block";
}
function hideLogin(){
login_box.style.display="none";
}
eventUtil.addHandler(login_btn,"click",showLogin);
eventUtil.addHandler(close,"click",hideLogin);