ich will, dass rot blau rot blau ... und dann Zelle H rot blau rot auf den ersten Zelle E blinkt blinkt ......setInterval wie funktioniert es?
Aber nur Zel blinkt.
Was ist zu ändern?
es scheint, dass es für i nur run = Select = 2
<script>
var blinkColors=new Array('red','blue','red','blue','red','blue','red','blue');
var selectCell = 2;
for (var i = 0; i <=selectCell -1; i++)
{
var blinkColor=0;
var myBlink=setInterval(function(){doBlink(j);},300);
function doBlink(x)
{
var jj=x;
var blinkCell=document.getElementById('blinker'+jj);
blinkCell.style.backgroundColor=blinkColors[blinkColor];
blinkColor++;
if(blinkColor==blinkColors.length)
{
stopBlink();
}
}
function stopBlink()
{
clearInterval(myBlink);
}
}
</script>
</head>
[Like this] (https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval) – Teemu
ich meine Zelle blinker0 und blinker1 statt Zelle E und Zelle H – Joachim
Veröffentlichen Sie Ihren HTML-Code? – Pugazh