-
for循环方式
for(var i= 0; i< document.querySelectopAll(".a").length; i ++){
document.querySelectopAll(".a")[i].style.color= "red";
}
-
forEach
借助call()实现
[].forEach.call(document.querySelectorAll(".aa"), function(){
console.log("1")
});
网友评论