-2
我需要讓身體的背景顏色從顏色列表動態變化。當然,我需要它順利地改變。如果您有任何想法,請幫忙!它也必須在一個循環中,所以顏色會重複。我在想while(1)
爲什麼讓身上的彩虹背景標籤不起作用?
我已經試過無處不在!
P.S.我試過用DOM
改變它,但我無法成功。 我已經tryed以下的JavaScript
while(1){
document.body.style.backgroundColor = "red";
document.body.style.backgroundColor = "orange";
document.body.style.backgroundColor = "green";
document.body.style.backgroundColor = "blue";
}
它使任何意義? 我剛試過一切!如果您有任何想法,請務必分享!
如果你想看到它發生,切勿使用while循環來更新DOM。而是使用setTimeout或setInterval – mplungjan