Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript change color every second

function change(i) {  
   var doc = document.getElementById("background");  
   var color =[ "black", "blue", "brown", "green"];  
   for(i=0; i<color.length; i++){  
        doc.style.backgroundColor = color[i];  
        alert("my color is "+ color[i]);  
/*if (i>=color.length){i=0;}*/  
    }
 }  
setInterval(function changebackground(){change(0)},1000);
Comment

PREVIOUS NEXT
Code Example
Javascript :: window load 
Javascript :: require a json as a string 
Javascript :: moment get iso week number 
Javascript :: domparser is not defined 
Javascript :: change select value jquery 
Javascript :: get the text of a tag 
Javascript :: add class with javascript 
Javascript :: javascript file exists check 
Javascript :: Passing components as children in react 
Javascript :: display console log in HTML 
Javascript :: javascript change background color setinterval 
Javascript :: js array last element get 
Javascript :: vue 3 script setup dynamic component sample 
Javascript :: add property to all documents mongo 
Javascript :: javascript sort array of objects 
Javascript :: formgroup is not property of form angular 
Javascript :: typescript express next middleware type 
Javascript :: react dont render until loaded 
Javascript :: react chart js 2 
Javascript :: node sass version react 
Javascript :: Converting string to json object 
Javascript :: javascript datetime format 
Javascript :: useeffect dependency error 
Javascript :: datatables server side 
Javascript :: electron new window 
Javascript :: fs.readfile 
Javascript :: webpack error cannot find module 
Javascript :: move first element to last javascript 
Javascript :: change focus to next field jquery after enter 
Javascript :: filter multidimensional array javascript 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =