Document.doctype (Property)

The current document type of the document.

Availability:

DOM level - 1
JavaScript - 1.5
JScript - 3.0
Internet Explorer - 4.0
Netscape - 6.0
Property/method value type:Doctype object
JavaScript syntax:-myDocument.doctype
HTML syntax:<!DOCTYPE aDocumentDescription>
Argument list:aDocumentDescriptionA reference to a DTD for this document

The <!DOCTYPE> tag at the top of the document is instantiated into a Doctype object and a reference to it is stored here. This tag describes a DTD statement that identifies the type of document.

Here is a properly formed DTD statement:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 FINAL//EN">

This is represented by an object whose type is a single exclamation mark. As this tag should be on the first line of a document, the object will be at index 0 in the document.all[] array.

Support for this is still somewhat patchy as of Netscape 6.0 and MSIE 5.5. Netscape 6.0 returns a DocType object (note the class name capitalization) but its string value is not defined. MSIE returns an undefined value.

Warnings:

See also:! object, !.tabIndex, Doctype object, Document object, Element object

Property attributes:

ReadOnly.