index.html에 있는 모든 a태그의 글자 색깔을 배경색과 반전되게 하려한다.
<input type="button" value="night" onclick="
let aTagSearch = document.querySelectorAll('a');
// console.log(aTagSearch);
if (this.value == 'night'){
document.querySelector('body').style.backgroundColor='black';
document.querySelector('body').style.color='white';
this.value = 'day';
for(let i=0; i<aTagSearch.length; i++){
aTagSearch[i].style.color = 'white';
}
} else {
document.querySelector('body').style.backgroundColor='white';
document.querySelector('body').style.color='black';
this.value = 'night';
for(let i=0; i<aTagSearch.length; i++){
aTagSearch[i].style.color = 'black';
}
}">