Answers for "write a js code to change the background color of the webpage automatically after every 5 sec."

0

javascript change background color setinterval

var i = 0;
function change() {
  var doc = document.getElementById("background");
  var color = ["black", "blue", "brown", "green"];
  doc.style.backgroundColor = color[i];
  i = (i + 1) % color.length;
}
setInterval(change, 1000);
Posted by: Guest on December-14-2020

Code answers related to "write a js code to change the background color of the webpage automatically after every 5 sec."

Code answers related to "Javascript"

Browse Popular Code Answers by Language