js中for循环里不能给别的class添加classname么??我这边添加删除都没有效果
// JavaScript Document
window.onload=function(){
var shopClass_item=document.getElementsByClassName("shopClass_item");
var shopClass_list=document.getElementsByClassName("shopClass_list");
for(i=0;i<shopClass_item.length;i++){
shopClass_item[i].onmouseover=function(){
this.style.backgroundColor="#51dee3";
shopClass_list[i].classList.remove("hide")
}
shopClass_item[i].onmouseout=function(){
this.style.backgroundColor="#4593fd";
shopClass_list[i].classList.add("hide");
}
}
}