writes-a-program-that-animate-the background-color-of-a-document-using-JavaScript.
writes a program that animates the background color of a document using JavaScript.
<!DOCTYPE html>
<html>
<head>
<!--  writes a program that animate the background color of a document using JavaScript.  -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.Coral {
  width: 100%;
  padding: 25px;
  background-color: coral;
  color: white;
  font-size: 25px;
  box-sizing: border-box;
}
.Red {
  width: 100%;
  padding: 25px;
  background-color: red;
  color: white;
  font-size: 25px;
  box-sizing: border-box;
}
.Yellow {
  width: 100%;
  padding: 25px;
  background-color: yellow;
  color: white;
  font-size: 25px;
  box-sizing: border-box;
}
</style>
<title>Q1</title>
</head>
<body>

<button onclick="Coral()">Coral</button>
<button onclick="Red()">Red</button>
<button onclick="Yellow()">Yellow</button>
<br><br><br><br>
<div id="myDIV">
This is a DIV element.
</div>

<script>
function Coral() {
   var element = document.getElementById("myDIV");
   element.classList.remove("Red");
   element.classList.remove("Yellow");
   element.classList.add("Coral");
}
function Red() {
   var element = document.getElementById("myDIV");
   element.classList.remove("Coral");
   element.classList.remove("Yellow");
   element.classList.add("Red");
}
function Yellow() {
   var element = document.getElementById("myDIV");
   element.classList.remove("Red");
   element.classList.remove("Coral");
   element.classList.add("Yellow");
}
</script>

</body>
</html>