문서의 제목을 가져오거나 변경하는 방법 - document.title

document title 속성으로 문서의 제목을 가져오거나 변경할 수 있습니다.

document.title

document.title 속성으로 문서의 제목을 가져오거나 변경할 수 있습니다.

 

기본형 1

document.title
  • 문서의 <title> 태그의 내용을 반환합니다.

 

기본형 2

document.title = 'ABC'
  • 문서의 <title> 태그의 내용을 ABC로 바꿉니다.

 

예제

문서의 제목을 출력하고, 제목을 JavaScript document title로 바꿉니다.

document.write ( '<p>' + document.title + '</p>' );
document.title = 'JavaScript document title';

로딩 중... 잠시만 기다려주세요.
자바스크립트를 허용해주세요.

Post a Comment