DOCTYPE只讀屬性返回與當前文檔相關(guān)的文檔類型聲明(DTD)。
返回的對象實現(xiàn)DocumentType對象。
DocumentType對象具有name屬性,該屬性返回doctype的名稱。
如果沒有與當前文檔關(guān)聯(lián)的DTD,則doctype屬性返回null。
document.doctype
var doctypeObj = document.doctype; doctypeObj.name;測試看看?/?
所有瀏覽器都完全支持doctype屬性:
屬性 | ![]() | ![]() | ![]() | ![]() | ![]() |
doctype | 是 | 是 | 是 | 是 | 是 |
返回值: | 文檔的doctype,作為DocumentType對象 |
---|---|
DOM版本: | DOM級別1 |