You don't want to do this:
function setColor(color) {
// ...
selectorAll_A[i].style.color = 'color';
// ...
}
It will ignore your color
parameter and try to se the selectorAll_A[i].style.color
property to the string 'color'
.
Instead, pass the value as a string and use the parameter name as the property value:
function setColor(color) {
// ...
selectorAll_A[i].style.color = color;
// ...
}
setColor('blue');
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…