DOM doctype属性用于返回任何HTML文档的doctype。 DocumentType对象是用于返回对象名称的name属性。如果文档中未声明doctype,则它将返回Null值。
用法:
document.doctype
例:
DOM doctype Propertyh1, h2 {
color:green;
font-weight:bold;
text-align:center;
}
body {
text-align:center;
}
GeeksForGeels
DOM doctype Property
Submit
function geeks() {
var gfg = document.doctype.name;
document.getElementById("sudo").innerHTML = gfg;
}
输出:
支持的浏览器:DOM doctype属性支持的浏览器如下:
谷歌浏览器
IE浏览器
火狐浏览器
Opera
苹果浏览器