Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #change #background #color #setinterval
ADD COMMENT
Topic
Name
8+1 =