element style background color code example
Example 1: how to change background color using js
var warning = document.getElementById("warning");
warning.style.background-color = "red";
Example 2: how to set background colour i js inline stylel
<!DOCTYPE html>
<html>
<head>
<title>HTML Backgorund Color</title>
</head>
<body style="background-color:grey;">
<h1>Products</h1>
<p>We have developed more than 10 products till now.</p>
</body>
</html>