JS获取页面doctype,有木有大侠晓得,并且可以兼容IE,firefox的

JS获取页面doctype,有木有大侠知道,并且可以兼容IE,firefox的
我现在需要实现个功能,就是获取页面上的doctype,需要知道里面是否声明了"http://www.w3.org/TR/html4/loose.dtd"这个loose.dtd,有没有大侠知道呢? 我需要至少在IE和火狐上面是支持的哟 谢谢大家了

------解决方案--------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>test</title>
<script type="text/javascript">
window.onload = function(){
var doctype = "";
if(document.doctype){
doctype =  document.doctype.systemId;
}else if(document.all && document.documentElement){
var html = document.documentElement.previousSibling;
if(html && html.nodeType == 8){
doctype = html.data;
}
}
if(doctype.indexOf("loose.dtd") >= 0){
alert("YES");
}else{
alert("NO");
}
};
</script>
</head>
<body>
</body>
</html>