# 제어할 태그 선택

### 예시) 주/야간모드 버튼 하나씩 만들기

![night를 누르면 야간, day를 누르면 주간 모드가 되는 2개의 버튼 속성 설정](https://3193435092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Miu1tqKdNPM-BV0usUx%2F-Mj8hJPCVOwahsAUc_LL%2F-Mj8heq3xTPhEO4hyITc%2F%EC%9D%B4%EB%AF%B8%EC%A7%80%20050.jpg?alt=media\&token=2c618bd7-dee8-4e5b-bdd4-f20d0d82115f)

```javascript
document.querySelector(selectors);
document.querySelectorAll(selectors);
```

```javascript
<body>
   <input type="button" value="night" onclick="
        document.querySelector('body').style.backgroundColor = 'black';
        document.querySelector('body').style.color = 'white';
    ">
    
    <input type="button" value="day" onclick="
        document.querySelector('body').style.backgroundColor = 'white';
        document.querySelector('body').style.color = 'black';
    ">
</body>
```

1. &#x20;"night"버튼을 눌렀을때 배경은 'black', 글자색은 'white'로 수정됨
2. &#x20;"day"버튼을 눌렀을때 배경은 'white', 글자색은 'black'으로 수정됨
