是否自加减代码顺序会影响到代码正确运行
document.onkeyup = function(event){
event = event || window.event;
for(var i=0;i<as.length;i++){
as[i].style.background = 'none';
}
if(event.keyCode == 38){
if(index<=0){
index = as.length;
}
index--;
as[index].style.background = '#ccc';
}else if(event.keyCode == 40){
index++;
if(index>=as.length){
index = 0;
}
as[index].style.background = '#ccc';
}else if(event.keyCode == 13 && index!=-1){
title.innerHTML = as[index].innerHTML;
menu.style.display = 'none';
index = -1;
}
}