87,922
社区成员
发帖
与我相关
我的任务
分享
var aa=document.getElementsByTagName("li");
for (var i=1;i<=aa.length;i++){
aa[i-1].style.backgroundImage="url(j"+ i+"1.jpg')"; //设置开始的背景图片,这是可以的。
changeBg(i);
}
function changeBg(idx){
aa[idx-1].onmouseover=function(){this.style.backgroundImage="url(j"+idx+"2.jpg)";}
aa[idx-1].onmouseout=function(){this.style.backgroundImage="url(j"+idx+"1.jpg)"; }
}