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 248 views
1 answer 246 views
1 answer 209 views
1 answer 242 views
1 answer 260 views
1 answer 292 views
...