name property (doctype)
Returns the name of the doctype element.
The name is specified immediately after the DOCTYPE keyword.
Syntax:
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" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <script type="text/javascript"> function GetDocType () { if (document.doctype) { var docTypeName = document.doctype.name; 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!"); } } </script> </head> <body> <button onclick="GetDocType ();">Get DOCTYPE properties!</button> </body> </html> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments