排他思想: 先把所有设为空,再设置当前要的属性为特定值
li.addEventListener('click', function() {
for (var i = 0; i < ol.children.length; i++) {
ol.children[i].className = '';
}
this, this.className = 'current';
})
2024-01-27 15:40:40
li.addEventListener('click', function() {
for (var i = 0; i < ol.children.length; i++) {
ol.children[i].className = '';
}
this, this.className = 'current';
})
下一篇:07包机制