总结

130 阅读1分钟

隔行变色

    for (var i = 0; i < oLis.length; i++) {
        oLis[i].style.background = i % 2 ? 'blue' : 'red';
        olis[i].myindex = i;
        oLis[i].onmouseenter = function () {
            col = this.style.background;
            this.style.background = 'black'
        }
        oLis[i].onmouseleave = function () {
            this.style.background = col;
        }
        oLis[i].onclick = function () {
            alert(
        }
    }