자바스크립트 HTML DOM HTML 데이터에 액세스하고 조작하는 몇 가지 기본 방법을 제공했습니다. 제목 을 찾으려면 및 URL 문서의 경우 자바스크립트가 document.title을 제공했습니다. 및 document.URL 각기. 개별적으로 논의합시다.
문서 제목
문서의 제목을 얻으려면 자바스크립트 HTML DOM document.title을 제공했습니다. 방법.
다음 예에서 제목 문서의 내용이 검색되어 출력에 표시된 대로 표시됩니다.
예시
<html>
<head>
<title>Tutorix</title>
</head>
<body>
<script>
document.write("The title of the document is" +" "+ document.title);
</script>
</body>
</html> 출력
Tutorix
문서의 URL
URL 을 얻으려면 문서 자바스크립트 HTML DOM document.URL을(를) 제공했습니다. 방법.
다음 예에서 URL 문서가 발견되어 출력에 표시됩니다.
예시
<html>
<body>
<script>
document.write("The URL of the document is:" + " " +document.URL)
</script>
</body>
</html> 출력
The URL of the document is: https://www.tutorialspoint.com/cg/assets/ovPEzF.php