SYNCERのロゴ
アイキャッチ画像

Document.doctype - 文書型宣言

doctypeは、Documentのプロパティです。ドキュメントの文書型宣言(DocumentType)を返します。

概要

名前
doctype
所属
Document
IDL
readonly attribute DocumentType? doctype;
仕様書
https://dom.spec.whatwg.org/#dom-document-doctype

説明

DocumentTypeを返す。読み取り専用なので、値を代入して変更することはできない。

デモ

Document.doctypeのデモです。

<!-- このコードは編集できます。 -->

<!DOCTYPE html>
<html>
<body>
<script>
var value = document.doctype ;

console.log( value ) ;
document.body.appendChild( new Text( value ) ) ;
</script>
</body>
</html>

サポート状況

ChromeFirefoxSafariEdgeIEOperaiOS SafariAndroid
  • Twitterでシェア
  • Facebookでシェア
  • Google+でシェア
  • はてなブックマークでシェア
  • pocketに保存
  • LINEでシェア
更新履歴
2017年10月5日 (木)
コンテンツを公開しました。