Javascript上からCSSを操作する方法
ソース:
<html> <head> <script language="JavaScript"> counter=1; function Test(){ if(counter==1){ document.getElementById("content").style.background = "blue"; counter=2; }else if(counter==2){ document.getElementById("content").style.background = "green"; counter=1; } setTimeout("Test()",5000); } </script> </head> <body id="content" onload="Test()"> </body> </html>
解説: