Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

document.doctype

概述

返回当前文档关联的文档类型定义(DTD). 返回的对象实现了 DocumentType 接口. 使用 DOMImplementation.createDocumentType 方法可以创建一个DocumentType类型的对象.

语法

doctype = document.doctype;
  • doctype 是一个只读属性.

示例

var doctypeObj = document.doctype;

alert(
  "doctypeObj.name: "           + doctypeObj.name            + "\n" +
  "doctypeObj.internalSubset: " + doctypeObj.internalSubset  + "\n" +
  "doctypeObj.publicId: "       + doctypeObj.publicId        + "\n" +
  "doctypeObj.systemId: "       + doctypeObj.systemId
);

附注

如果当前文档没有DTD,则该属性返回null.

在HTML文档中,如果文档有DTD,则该属性等价于document.firstChild.

DOM level 2 不支持编辑文档类型定义.

规范

文档标签和贡献者

 此页面的贡献者: teoli, jsx, ziyunfei
 最后编辑者: jsx,