HTML DOM inputEncoding 属性 | HTML DOM Document 对象

返回到:DOM 对象:HTML DOM Document 对象

定义和用法

inputEncoding 属性可返回文档的编码(在解析时)。

如果问的在内存中创建返回 null 。

浏览器支持:

除了 Opera浏览器,所有主流浏览器都支持 inputEncoding 属性。

注意: Internet explorer 8 及更早IE 版本不支持该属性。

语法

document.inputEncoding

技术细节

返回值:字符串,返回文档编码
DOM 版本Core Level 3 Document Object

实例

显示当前文档的字符编码:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Web176教程网(web176.com)</title>
</head>
<body>

<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>

</body>
</html>

作者:terry,如若转载,请注明出处:https://www.web176.com/javascriptbook/domtips/4644.html

(0)
打赏 支付宝 支付宝 微信 微信
terryterry
上一篇 2021年12月15日 下午2:34
下一篇 2021年12月15日 下午2:39

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注