Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- 바인딩변수
- @RequestParam
- @
- 비즈니스레이어
- 어노테이션
- 유효성검사
- @ResponseBody
- frontController
- spring
- MVC
- application.properties
- 서비스레이어
- produces
- springmvc
- jointpoint
- 스프링
- SpringBoot
- PointCut
- springjdbc
- after-throwing
- @Valid
- .xml
- @RequestMapping
- gradle
- 의존주입
- c:if
- AOP
- 생성자주입
- Java
- Model
Archives
- Today
- Total
메모장
14. 조건문 예고 본문
728x90
반응형
조건문 이라고 하는 것은 하나의 프로그램이 하나의 흐름으로 가는 것이 아니라 조건에 따라 다른 순서의 기능들이 실행되게 하는 것 이라고 할 수 있습니다.
야간모드에서 버튼을 클릭하면 주간모드가 되고, 주간모드에서 버튼을 클릭하면 야간모드가 되는 기능을 구현하고 싶다. ---> 이것을 토글 (toggle)이라고 한다.
<input type="button" value="night" onclick="
if(document.querySelector('#night_day').value === 'night'){
document.querySelector('body').style.backgroundColor = 'black';
document.querySelector('body').style.Color = 'white';
document.querySelector('#night_day').value = 'day'
} else {
document.querySelector('body').style.backgroundColor = 'white';
document.querySelector('body').style.Color = 'black';
document.querySelector('#night_day').value = 'night'
}
">
즉 if 라는 조건문에 따라 현재 모드가 주간모드라면 if 의 코드가 실행되고, 주간모드가 아니라면 else의 코드가 실행됩니다. 조건문과 함께 === 라는 비교 연산자도 살펴 볼 텐데, 이 비교 연산자를 통해 만들어진 불리언(boolean) 이라는 것도 살펴볼 예정입니다.
728x90
반응형
'JavaScript > [생활 코딩 JS]' 카테고리의 다른 글
| 16. 조건문 (0) | 2024.04.25 |
|---|---|
| 15. 비교 연산자와 불리언 (0) | 2024.04.25 |
| 13. 프로그램, 프로그래밍 , 프로그래머 (0) | 2024.04.24 |
| 12. 제어할 태그 선택하기 (0) | 2024.04.24 |
| 11. css 기초: 선택자 (0) | 2024.04.24 |