-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest01.html
More file actions
40 lines (37 loc) · 1.35 KB
/
test01.html
File metadata and controls
40 lines (37 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<html>
<head>
<script>
function nightDay(self){
var target = document.querySelector('body');
if(self.value === 'night'){
target.style.backgroundColor='black';
target.style.color='white';
self.value='day';
var alist = document.querySelectorAll('a');
for(var i =0; i<alist.length;i++){
alist[i].style.color="powderblue";
}
} else if(self.value==='day'){
target.style.backgroundColor='white';
target.style.color='black';
self.value = 'night';
var alist = document.querySelectorAll('a');
for(var i =0; i<alist.length;i++){
alist[i].style.color="red";
}
}
}
</script>
</head>
<body>
<input id="button" type="button" value="night" onclick="
nightDay(this);
"
>
<ul>
<li><a href = "https://naver.com" target="black">a</a></li>
<li><a href = "http://google.com" target="black">b</a></li>
<li><a href = "http://daum.net" target="black">c</a></li>
</ul>
</body>
</html>