How to set HTML document background color with JavaScript

1 Answer

0 votes
<!DOCTYPE html>
<html>
<body>

<button onclick="SetBackgroundColor()">Set Background Color</button>

<script>
function SetBackgroundColor() {
  document.body.style.backgroundColor = "green";
}
</script>

</body>
</html>

 



answered Jan 11, 2019 by avibootz

Related questions

1 answer 244 views
1 answer 242 views
1 answer 204 views
1 answer 235 views
1 answer 256 views
1 answer 280 views
...