HTML DOM documentMode 屬性

定義和用法
documentMode 屬性返回瀏覽器渲染文檔的模式。
IE8 使用不同方式渲染頁面,基于 !DOCTYPE 或者某些存在的HTML元素。
這些元素返回值如下:
- 5 - 頁面在 IE5 模式下展示
- 7 - 頁面在 IE7 模式下展示
- 8 - 頁面在 IE8 模式下展示
- 9 - 頁面在 IE9 模式下展示
注意:如果沒有指定 !DOCTYPE , IE8 以 IE5 模式渲染頁面。
語法
document.documentMode
瀏覽器支持
documentMode 是 IE 瀏覽器特定屬性,在IE8及之后的IE版本都支持該屬性。
實例
實例
返回瀏覽器渲染頁面使用的模式:
<html>
<body>
This document is displayed in:
<script>
document.write(document.documentMode);
</script>
</body>
</html>
<body>
This document is displayed in:
<script>
document.write(document.documentMode);
</script>
</body>
</html>
嘗試一下 ?

更多建議: