name property
Gets the name of the root element of a document type.
![]() ![]() |
Syntax
| JavaScript | |
|---|
Property values
Type: String
The root element name
Standards information
Remarks
The value of the name property corresponds to the TopElement attribute of a !DOCTYPE directive.
Examples
The following example shows the name property with respect to a !DOCTYPE directive.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>IE9 Doctype Sample: Name</title>
<meta name="x-ua-compatible" content="ie=9">
<script type="text/javascript">
function showInfo() {
var s = document.doctype.name;
// Displays "HTML"
alert( s );
}
</script>
</head>
<body>
<button onclick="showInfo();">Click Me!</button>
</body>
</html>
See also
- documentType
- Reference
- publicId
- systemId
Send comments about this topic to Microsoft
Build date: 11/27/2012

