I want to manipulate a single color from a forum’s userlist.
The User is displayed like this:
<span style="color:#1381A5">username</span>
My latest shot is this one:
var spans = document.getElementsByTagName("span");
for(var i = spans.length - 1; i >= 0; i--) {
if(spans[i].style.color == "#1381A5") {
var span = spans[i];
span.style.color ='red';
}
}
Do you have some hints how to pic&replace the color value ?
Thanks in advance.
The reason for your script not working is, I believe, in that line of code:
See, the
spans[i].style.colorvalue is:which is certainly not equal to
#1381A5One option would be to change the line above to:
which should solve your issue.