Movatterモバイル変換


[0]ホーム

URL:


  1. Веб-технологии для разработчиков
  2. Интерфейсы веб API
  3. Document
  4. Document.head

This page was translated from English by the community.Learn more and join the MDN Web Docs community.

View in EnglishAlways switch to English

Document.head

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since июнь 2018 г..

Возвращает элемент<head> текущего документа. Если имеется более одного элемента<head>, будет возвращён первый из них.

Синтаксис

var objRef = document.head;

Значение

HTMLHeadElement.

Пример

<!doctype html><head>  <title>Example: using document.head</title></head><script>  var theHead = document.head;  console.log(theHead.id); // "my-document-head";  console.log( theHead === document.querySelector("head") ); // true</script>

Примечание

document.head доступно только для чтения. Присвоить значение этому свойству нельзя. При попытке это сделать ошибка вызвана не будет, только если вы не используетеStrict Mode. В данном случае будет вызваноTypeError .

Спецификации

Specification
HTML
# dom-document-head-dev

Совместимость с браузерами

Смотрите также

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp