Well, basically, one of my comrades practiced JS, and he had the idea of ββa test base site. So I said that we will have a race to finish it. On this we both encountered a mistake. We created the color in JS. However, when we need to output, this will not work. I have it.
document.getElementById("outputColor").style.backgroundColor=currentColor;
If the current color is made using this
part1 = Math.floor(Math.random() * (255 - 0 + 1)) + 0; part2 = Math.floor(Math.random() * (255 - 0 + 1)) + 0; part3 = Math.floor(Math.random() * (255 - 0 + 1)) + 0; currentColor = "\"rgb (" + part1 + ", " + part2 + ", " + part3 + ")\"";
Putting the current color in "" means that it expects the value of currentColor. Not the actual value of the variable.
Hope this makes sense. Is this possible, or are we barking the wrong tree?
thanks
Edit: It already has the css style associated with it
#outputColor { height: 100px; width: 100px; background-color: rgb(0,0,0); }
Edit: Allowed, Solution
currentColor = "rgb(" + part1 + ", " + part2 + ", " + part3 + ")";
Thanks everyone!
source share