HTML DOM doctypeProperty

Document 对象参考手册Document Object

Examples

Return the DocumentType object for the HTML document:

document.doctype;

Try it Yourself »

Definition and Usage

The doctype property returns the Document Type Declaration associated with the document.

For more information about the DocumentType object, see theDocumentType Object Reference.

Note:If the document does not specify a document type, the return value isnull.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the doctype property

Note:When Internet Explorer 8 and earlier versions display HTML and XHTML documents, this property returnsnull, but supports XML documents.


Syntax

document.doctype

Technical Details

Return Value: The document type of the document, as a DocumentType object.
DOM Version Core Level 1 Document Object


Document 对象参考手册Document Object

Other Extensions