2016-08-23 2 views
0

나는이 스크립트를 사용하여 나중에 배경색을 지속적으로 변경하도록 프로그램 할 것이지만, 어떤 이유로 그것이 전혀 작동하지 않는다. 그것은 노력이 코드를 오류 중 하나JS를 사용하여 웹 페이지의 배경색을 어떻게 변경합니까?

더에 refrence 검사에 대한
<html> 
<body id = "BGCOLOR" bgcolor = rgb(0,0,0); > 
<script> 
function ChangeColor(){ 
    document.getElementById("BGCOLOR").bgcolor = "rgb(0,50,0)"; 
} 
ChangeColor(); 
</script> 
</body> 
</html> 
+0

당신이 참조 http://stackoverflow.com/questions/197748/ 어떻게 - 할 - 변화 - 배경 - 색상 -와 자바 스크립트 –

답변

0

친구를 던지고 아니에요

<html> 
    <body id = "BGCOLOR" bgcolor = rgb(0,0,0); > 
    <script> 
    function ChangeColor(){ 
     document.body.style.backgroundColor = "rgb(0,50,0)"; 
    } 
    ChangeColor(); 
    </script> 
    </body> 
    </html> 
관련 문제