+ 2

How would u change the color of a webpage using JavaScript

When you are creating a website and what it to change its background-color, if something evaluates to true or if an event happened, then, how would you do it.

23rd Sep 2017, 7:13 PM
Bryan
Bryan - avatar
4 odpowiedzi
+ 4
/* if (statement) ChangeBackgroundColour(Green); */ //This is the theoretical code. if (1==1) document.body.style.backgroundColor = "green"; //This is practical code.
23rd Sep 2017, 7:48 PM
Eldar Bakerman
+ 5
you can use JavaScript and the getElementById fonction and then you can apply an new color to the background.
23rd Sep 2017, 7:48 PM
Aymen ELARBI
+ 2
Thx
23rd Sep 2017, 8:17 PM
Bryan
Bryan - avatar
+ 1
Please uf my abswer is satisfying you, mark it as the best answer.
24th Sep 2017, 5:07 AM
Eldar Bakerman