I try to change the background color at on small app in html css js one snap of this is:
JavaScript
x
18
18
1
var myoutput = document.getElementById("output");
2
3
function roundNum(){
4
AlphaValue=0.4;
5
RedValue=255;
6
GreenValue=0;
7
BlueValue=0;
8
outputColor=[RedValue,GreenValue,+BlueValue,AlphaValue];
9
return outputColor;
10
}
11
myColor=roundNum();
12
myColor1=myColor[0];
13
myColor2=myColor[1];
14
myColor3=myColor[2];
15
myColor4=myColor[3];
16
myoutput.style.backgroundColor ="(
17
rgba("+myColor1+","+myColor2+","+myColor3+","+myColor4+");";
18
Advertisement
Answer
Remove the (
from the first of your string, And remove ;
at the end.
Change:
JavaScript
1
2
1
myoutput.style.backgroundColor ="(rgba("+myColor1+","+myColor2+","+myColor3+","+myColor4+");";
2
To:
JavaScript
1
2
1
myoutput.style.backgroundColor ="rgba("+myColor1+","+myColor2+","+myColor3+","+myColor4+")";
2