Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
I try to change the background color at on small app in html css js

I try to change the background color at on small app in html css js one snap of this is:

var myoutput = document.getElementById("output");

function roundNum(){
AlphaValue=0.4;
RedValue=255;
GreenValue=0;
BlueValue=0;
outputColor=[RedValue,GreenValue,+BlueValue,AlphaValue];
return outputColor;
}
myColor=roundNum();
myColor1=myColor[0];
myColor2=myColor[1];
myColor3=myColor[2];
myColor4=myColor[3];
myoutput.style.backgroundColor ="( 
rgba("+myColor1+","+myColor2+","+myColor3+","+myColor4+");";
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Remove the ( from the first of your string, And remove ; at the end.

Change:

myoutput.style.backgroundColor ="(rgba("+myColor1+","+myColor2+","+myColor3+","+myColor4+");";

To:

myoutput.style.backgroundColor ="rgba("+myColor1+","+myColor2+","+myColor3+","+myColor4+")";
about 4 years ago · Juan Pablo Isaza Report

0

You have a couple of syntax issues there. You can not define multi-line strings with double or single quotes use backticks instead. And rgba does not start with a parenthesis before r and you done need a semicolon at the end;

myoutput.style.backgroundColor = `rgba(${myColor1},${myColor2},${myColor3},${myColor4})`;
about 4 years ago · Juan Pablo Isaza Report

0

You can use a function like this

const red = () => {
  const r = 255, g = 0, b = 0, a = 1;
  return `${r},${g},${b},${a}`;
}

document.body.style.backgroundColor = `rgb(${[red()]})`;
<html>
<body></body>
<html>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!