• 회원가입
  • 로그인
  • 구글아이디로 로그인

[Window_Object] JS - window 객체 - 윈도우객체 (속성/메서드) 종류

  1. Window 객체 정의
  2. Window 객체의 속성
  3. Window 객체의 메서드

 

Window 객체 정의

 

window 객체는 브라우저에서 열린 의미.

 


 

1.

  • 웹문서에 <iframe> 태그 포함 시, 브라우저는 HTML 문서용 window 객체, 각각의 아이프레임용 widnow 객체 만듦.
  • Window 객체에 대한 공개 표준은 없지만, 모든 주요 브라우저가 이를 지원.

 

2. Window 객체

  • JavaScript에는 항상 전역 객체가 정의되어 있음. 
  • 프로그램이 전역 변수를 만들 때 전역 객체의 구성원으로 만들어짐. 
  • window 객체는 브라우저의 전역 객체임. 
  • 모든 전역 변수 또는 함수는 window 개체로 접근 가능함. 
  • 전역 변수를 정의한 후 window 객체에서 해당 값에 접근 가능함.
  • window 객체 사용해 동적변수 (= 가변변수 = 유동변수) 생성 가능.


 

Window 객체의 속성

 

  • window.closed - 창이 닫혀 있는지 여부 나타내는 참거짓 반환.
  • window.console - 브라우저의 콘솔에 정보를 기록하는 메소드를 제공하는 Console 객체에 대한 참조 반환 (Console 객체 참조)
  • window.defaultStatus - 창의 상태표시줄에 있는 기본 텍스트를 설정하거나 반환.
  • window.document  - 윈도우의 Document 객체 반환 (Document 객체 참조).
  • window.frameElement - 현재창이 삽입 된 <iframe> 요소 반환.
  • window.frames - 현재창에서 모든 <iframe> 요소를 반환.
  • window.history - 창의 History 객체를 반환. (History 객체 참조).
  • window.innerHeight - 스크롤 바를 포함하여 창 내용 영역 (= viewport) 높이 반환. 
  • window.innerHeight - 스크롤 바를 포함하여 창 내용 영역 (= viewport) 너비 반환.
  • window.jQuery - jQuery 라이브러리 로드 여부 확인.
  • window.length - 현재창에서 <iframe> 요소의 개수 반환.
  • window.localStorage - 웹 브라우저에 key / value 쌍을 저장 가능. 만료 날짜 없는 데이터 저장.
  • window.location - 창의 Location 객체 반환 (Location 객체 참조).
  • window.name - 창이름 설정하거나 반환.
  • window.navigator - 창 Navigator 객체 반환 (Navigator 객체 참조).
  • window.opener - 창 생성한 window에 대한 참조 반환.
  • window.outerHeight - toolbar / scrollbar 포함해 브라우저 창 높이 반환.
  • window.outerWidth - toolbar / scrollbar 포함해 브라우저 창 너비 반환.
  • window.pageXOffset - 현재 문서가 창의 왼쪽상단 구석으로부터 (가로로) 스크롤 된 픽셀 반환.
  • window.pageYOffset - 현재의 문서가 창의 왼쪽상단 구석으로부터 (세로로) 스크롤 된 픽셀 반환. 
  • window.parent - 현재창의 부모창 반환.
  • window.screen - 창의 screen 객체 반환 (Screen 객체 참조).
  • window.screenLeft - 화면에 상대적인 창의 수평 좌표 반환.
  • window.screenTop - 화면을 기준으로 한 창의 세로 좌표 반환.
  • window.screenX - 화면을 기준으로 한 창의 가로 좌표를 반환.
  • window.screenY - 화면에 상대적인 창의 세로 좌표를 반환.
  • window.sessionStorage - 웹 브라우저에 key / value 쌍을 저장 가능. 하나의 세션에 대한 데이터 저장.
  • window.scrollX - pageXOffset의 별칭
  • window.scrollY - pageYOffset의 별칭
  • window.self - 현재창을 반환.
  • window.status - 창의 상태표시줄에있는 텍스트를 설정하거나 반환.
  • window.top - 최상위 브라우저창을 반환.

 

 

Window 객체의 메서드

 

 

※ Reflow : 크기와 위치에 맞게 브라우저에 배치하는 과정.

※ Repaint : Reflow 과정 끝난 후 재생성된 렌더 트리를 다시 그리는 과정.

 관련글 https://heowc.tistory.com/83

 


분류 제목
DOM_Attribute JS - attr.isId -
DOM_Attribute JS - attr.name -
DOM_Attribute JS - attr.value -
DOM_Attribute JS - attr.specified -
DOM_Attribute JS - nodemap.getNamedItem() 메서드 -
DOM_Attribute JS - nodemap.item() 메서드 -
DOM_Attribute JS - nodemap.length -
DOM_Attribute JS - nodemap.removeNamedItem() 메서드 -
DOM_Attribute JS - nodemap.setNamedItem() 메서드 -
Window_Console JS - console.assert() 메서드 - 표현식이 FALSE인지 확인 (= 표현식 거짓 여부 체크 …
Window_Console JS - console.clear() 메서드 - 콘솔 지우기 (=콘솔창 청소 = console.clear메…
Window_Console JS - console.count() 메서드 - 콘솔창에서 카운트하기 (= 숫자 세기 = console.co…
Window_Console JS - console.error() 메서드 - 콘솔창에서 에러메시지 띄우기 (= console.error메…
Window_Console JS - console.group() 메서드 - 콘솔에서 메시지 그룹 생성 시작 (= console.grou…
Window_Console JS - console.groupCollapsed() 메서드 - 콘솔에서 접힌/축소된 메시지 그룹 시작 지정…
Window_Console JS - console.groupEnd() - 메시지 그룹의 끝/종료 지점 지정 (= console.grou…
Window_Console JS - console.info() 메서드 - 콘솔에 메시지 쓰기 (= console.info메서드 = 콘솔…
Window_Console JS - console.log() 메서드 - 콘솔에 메시지 쓰기 (= console.log메서드 = 콘솔로그…
Window_Console JS - console.table() 메서드 - 콘솔에 테이블 쓰기 (= console.table메서드 = …
Window_Console JS - console.time() 메서드 - 콘솔창에서 타이머 시작 (= console.time메서드 = …
23/67
목록
찾아주셔서 감사합니다. Since 2012