0
I’m trying to make a Div have the background changed to the three primary colors in case Yellow, Blue and Red, however would only start to change the color 4 seconds after the page is updated, wrote a function that is called 4 seconds after the page refresh, but the colors do not change, in fact it ignores the first colors and jumps right to the last, and does not occur the animation effect, simply turns red, follows down the code...
<script>
var d = window.document.querySelector('div#msg');
setTimeout(mudarCor, 4000);
function mudarCor(){
var contador =0;
while(contador <= 9){
d.style.background = 'yellow';
d.style.background = 'blue';
d.style.background = 'red';
contador +=1;
}
}
</script>
I want you to change between the 3 colors, to show the colors changing on the screen, but I need it to be with the repeat structure for or while, because maybe I need to keep this running endlessly kkk.