document.head 사용 JavaScript의 속성을 사용하여 문서의
태그 ID를 가져옵니다. 다음 코드를 실행하여 document.head를 구현할 수 있습니다. JavaScript의 속성 -
<!DOCTYPE html>
<html>
<head id = "myid">
<title>JavaScript Example</title>
</head>
<body>
<h1>Employee Information</h1>
<form>
Name: <input type = "text" name = "name" value = "Amit"><br>
Subject: <input type = "text" name = "sub" value = "Java">
</form>
<script>
var a = document.head.id;
document.write("<br>Head element id? "+a);
</script>
</body>
</html>