搞不清楚哪里出问题了,就是不出来
function addEvent(ele,type,handler){
// 执行代码
if(ele.addEventLister){
ele.addEventLister(type,handler,false);
}else if(ele.attachEvent){
ele.attachEvent('on'+type,handler);
}else{
ele['on'+type]=handler;
}
};
//阻止冒泡
function stopPropagation(ev){
var oEvent=ev || event;
if(oEvent.stopPropagation){
oEvent.stopPropagation();
}else{
oEvent.cancelBubble=true;
}
}
// 显示登录层函数
function showLogin(){
login_box.style.display='block';
}
// 隐藏登录层函数
function hideLogin(ev){
var oEvent = ev || event;
login_box.style.display='none';
oEvent.stopProgation();
}
//点击登录按钮显示登录层
addEvent(login_btn,'click',showLogin);
//点击关闭按钮隐藏登录层
addEvent(close,'click',hideLogin);