// 闭包
for (var i = 0; i < document.querySelectorAll("li").length; i++) {
(function (i) {
document.querySelectorAll("li")[i].onmouseover = function () {
for (var j = 0; j < document.getElementsByTagName("li").length; j++) {
document.getElementsByTagName("li")[j].style.background = ""
}
document.getElementsByTagName("li")[i].style.background = "red"
}
})(i)
}