HTML DOM inputEncoding 属性
显示当前文档的字符编码:
<p id="demo">单击按钮确认文档的编码方式</p>
<button onclick="myFunction()">点我</button>
<script>
function myFunction() {
var x = document.getElementById("demo");
x.innerHTML = document.inputEncoding;
}
</script>
<p><strong>注意:</strong>Opera、Internet explorer 8及早前版本不支持inputEncoding属性。 </p>
定义和用法
inputEncoding 属性可返回文档的编码(在解析时)。
如果问的在内存中创建返回 null 。
浏览器支持
![]()
![]()
![]()
![]()
![]()
除了 Opera浏览器,所有主流浏览器都支持 inputEncoding 属性。
注意: Internet explorer 8 及更早IE 版本不支持该属性。
语法
document.inputEncoding
技术细节
| 返回值: | 字符串,返回文档编码 |
|---|---|
| DOM 版本 | Core Level 3 Document Object |
Document 对象
Document 对象