for (let i = 0; i < Li.length; i++) {
Li[i].setAttribute('index', i)
Li[i].onclick = function() {
用let声明i在内部点击函数可以调用到
用var声明i在内部点击函数不可以调用到
index = Li[i].getAttribute("index")
console.log(index)
for (let i = 0; i < Li.length; i++) {
Li[i].style.backgroundColor = "";
}
this.style.backgroundColor = "red"
for (let s = 0; s < div.length; s++) {
div[s].style.display = "none";
}
div[index].style.display = "block";
}
}