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 252 views
1 answer 252 views
1 answer 215 views
1 answer 246 views
1 answer 264 views
1 answer 302 views
...