JS - Setting Div Background Color Using A Variable
Well basically, one of my mates was practicing JS and he had an idea of a test basic site. So I said we would have a race to complete it. We have both run in to an error at this po
Solution 1:
There are too much double-quotes, use this:
currentColor = "rgb(" + part1 + ", " + part2 + ", " + part3 + ")";
Solution 2:
currentColor = "rgba(" + part1 + ", " + part2 + ", " + part3 + ",0)";
Solution 3:
currentColor = "rgb(" + part1 + ", " + part2 + ", " + part3 + ")"; // RGB
OR Using Hex format
currentColorHex="#"+(part1).toString(16)+(part2).toString(16)+(part3).toString(16);
Post a Comment for "JS - Setting Div Background Color Using A Variable"