You are here: Reference > JavaScript > client-side > HTML DOM > properties > name (doctype)

name property (doctype)

Browser support:
Returns the name of the doctype element.
The name is specified immediately after the DOCTYPE keyword.

You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

String that represents the name of the doctype element.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the name property:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
        <script type="text/javascript">
            function GetDocType () {
                if (document.doctype) {
                    var docTypeName =;
                    var pubIdStr = document.doctype.publicId;
                    var sysIdStr = document.doctype.systemId;

                    var message = "Document type: " + docTypeName;
                    message += "\nDOCTYPE publicId: " + pubIdStr;
                    message += "\nDOCTYPE systemId: " + sysIdStr;
                    alert (message);
                else {
                    alert ("Your browser does not support this example!");
        <button onclick="GetDocType ();">Get DOCTYPE properties!</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content