2-08.Window 객체
2023. 3. 29. 16:13ㆍJavascript/자바스크립트 제대로 배워볼래?
이번에는 Window 객체에 대해서 배울 예정이다.
아래의 링크에 간략하게 잘 정리되어있다. 참고하길!
참고 : https://kssong.tistory.com/29
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
</head>
<body>
<input type="text" />
<button type="button">저장</button>
<script>
console.log(window);
// alert
// window.alert("이것은 alert 창입니다.");
// alert("이것은 alert 창입니다.");
// confirm
// var yn = confirm("정말 삭제하시겠습니까?");
// console.log(yn); //확인취소에따라, true, false 출력
// if(confirm("진짜 삭제할거야?")){
// // 삭제실행
// console.log("삭제실행");
// }
// prompt
// var text = prompt("비밀번호를 입력하세요");
// console.log(text); //확인 누르면 내용이 출려되고, 취소 누르면 null이 출력된다
// if(txt == null) {
// } else if(txt == "") {
// } else if(xt != "") {
// console.log(txt);
// }
//열자마자 naver가 열리게 된다
// window.open("https://www.naver.com/");
// 인쇄화면이 나타나게 됨
// window.print();
// setTimeout
setTimeout(function(){
console.log("5초후 프로그램 실행")
}, 5000);
// setInterval - 계속 반복, clearInterval - 0부터 시작해서, 그 순간에 그만둠
var i = 0;
var fnc = setInterval(function(){
console.log("3초 마다 프로그램 실행" + i);
if(i==3){
clearInterval(fnc);
}
i++;
}, 3000);
</script>
</body>
</html>
'Javascript > 자바스크립트 제대로 배워볼래?' 카테고리의 다른 글
3-01.this 키워드 (0) | 2023.03.29 |
---|---|
2-09.크롬 개발자도구 (0) | 2023.03.29 |
2-07.JSON 객체 (0) | 2023.03.29 |
2-06.Math 내장 함수 (0) | 2023.03.29 |
2-05.Date 내장 함수 (0) | 2023.03.29 |