The usernames in the char look something like this:
@tntxtnt: He just wants to substitute colors, not to replace all of them.
You begin all tiny projects like this by the shortest time debug tests.
So, don't waste time re-packing your project each time, follow my advice and we'll get through.
There's a little I forgot to tell you:
1. Colors are stored as strings. As such, differently-formatted colors may not work (rgb vs # vs rgba...).
In my test, rgb(x, y, z) was the pattern.
2. You should use document.defaultView.getComputedStyle
var z = x[y];
var color = document.defaultView.getComputedStyle(z,0).color;
if(color == "rgb(0, 1, 2")
z.style.color = "rgb(1,2,3)"; // override the color using .style.color
And thanks for pointing out the ++y.
Chrome's tabs get stuck if that's forgotten.
Cool thanks it works SGH :) Now I just have to put a timer or something It seems like setinterval is what I want
Sweet it works thanks again SGH :)
1 2 3 4 5 6 7 8 9 10 11 12 13 14
setInterval( function() //set an interval
var x = document.getElementsByClassName('nick'); //create an array of all the nicknames
var y = 0; //iterator for array
while( y < x.length ) //loop through all elements of array
var z = x[y]; //create variable of just one element in array
var color = document.defaultView.getComputedStyle(z,0).color; //assign a standard for collor
if( z.style.color == "rgb(0, 255, 127)" ) //if it is spring green
z.style.color = "rgb(0, 0, 255)"; // override the color using .style.color to blue
, 1000 ); //set timer of 1 second