DOCTYPE只读属性返回与当前文档相关的文档类型声明(DTD)。
返回的对象实现DocumentType对象。
DocumentType对象具有name属性,该属性返回doctype的名称。
如果没有与当前文档关联的DTD,则doctype属性返回null。
document.doctype
var doctypeObj = document.doctype; doctypeObj.name;测试看看‹/›
所有浏览器都完全支持doctype属性:
| 属性 |  |  |  |  |  | 
| doctype | 是 | 是 | 是 | 是 | 是 | 
| 返回值: | 文档的doctype,作为DocumentType对象 | 
|---|---|
| DOM版本: | DOM级别1 |