본문 바로가기
프로그래밍 개발/JS 웹

Javascript Document 객체

by Jinseok Kim 2020. 11. 20.
반응형

 

 

Document 객체

 

 

 

Document 객체는 DOM의 스팩이고 이것이 웹브라우저에서는 HTMLDocument 객체로 사용된다. HTMLDocument 객체는 문서 전체를 대표하는 객체라고 할 수 있다. 

 

 

 

 

 

 

 

<script>

//document 객체는 window 객체의 소속이다.
console.log(window.document);

//document 객체의 자식으로는 Doctype과 html이 있다. 
console.log(window.document.childNodes[0]);
console.log(window.document.childNodes[1]);

</script>

 

 

 

 

노드 생성 API

 

document  객체의 주요 임무는 새로운 노드를 생성해주는 역할이다. 

 

  • createElement()
  • createTextNode()

 

 

문서 정보 API

 

  • title
  • URL
  • referrer
  • lastModified

 

 

 

반응형

댓글