<head>
<title>On and Off click</title>
<meta charset="utf-8" />
<script>
function LinksSetColor(color){
var alist = document.querySelectorAll('a');
var i = 0;
while(i < alist.length){
alist[i].style.color = color;
i = i + 1;
}
}
function BodySetColor(color){
document.querySelector('body').style.color = color;
}
function BodySetBackgroundColor(color){
document.querySelector('body').style.backgroundColor = color;
}
function nightDayHandler(self){
var target = document.querySelector('body');
if(self.value === 'night'){
Body.setBackgroundColor('black');
Body.setColor('white');
self.value = 'day';
Links.setColor('powderblue');
} else {
Body.setBackgroundColor('white');
Body.setColor('black');
self.value = 'night';
Links.setColor('blue');
}
}
</script>
</head>
<body>
<h1><a href="index.html">WEB</a></h1>
<input id="night_day" type="button" value="night" onclick="
nightDayHandler(this);
">
<ol>
<li><a href="1.html">HTML</a></li>
<li><a href="2.html">CSS</a></li>
<li><a href="3.html">JavaScript</a></li>
</ol>
<h2>WEB</h2>
<p>
The World Wide Web (abbreviated WWW or the Web) is an information space
where documents and other web resources are identified by Uniform Resource
Locators (URLs), interlinked by hypertext links, and can be accessed via
the Internet.[1] English scientist Tim Berners-Lee invented the World Wide
Web in 1989. He wrote the first web browser computer program in 1990 while
employed at CERN in Switzerland.[2][3] The Web browser was released
outside of CERN in 1991, first to other research institutions starting in
January 1991 and to the general public on the Internet in August 1991.
</p>
</body>
</html>
// 위의 내용을 크롬에 실행해 보니 실행이 되지 않아 검사를 해보니 아래와 같은 메세지가 뜹니다.
어떻게 해결해야 하는 지요.
js_object_객체_다시보기_01.html:25
Uncaught ReferenceError: Body is not defined
at nightDayHandler (js_object_객체_다시보기_01.html:25)
at HTMLInputElement.onclick (js_object_객체_다시보기_01.html:44)