HTML DOM Form acceptCharset property
Definition and Usage
acceptCharset property sets or returns a comma-separated list of server content is acceptable character sets.
grammar
formObject.acceptCharset=value
acceptCharset property can have the following values:
值 | 描述 |
---|---|
character-set | 一个或者多个服务器可接受的字符集 。 多个字符集,用逗号分隔集。
通常值:
理论上,可以使用任何字符编码,但不是所有浏览器都支持。所以请使用常用的字符编码。 所有字符编码,请查看本站的字符设置参考手册 。 |
Browser Support
All major browsers support acceptCharset property
Tips and Notes
NOTE: accept-charset attribute does not work in IE browsing.If the accept-charset = "ISO-8859-1", the data will be "Windows-1252" encoding transmission data.
Examples
Examples
Return form form accept-charset attribute values:
<html>
<body>
<form id="frm1" accept-charset="ISO-8859-1">
First name: <input type="text" name="fname" value="Donald"><br>
Last name: <input type="text" name="lname" value="Duck"><br>
</form>
<script>
document.write(document.getElementById("frm1").acceptCharset)
</script>
</body>
</html>
<body>
<form id="frm1" accept-charset="ISO-8859-1">
First name: <input type="text" name="fname" value="Donald"><br>
Last name: <input type="text" name="lname" value="Duck"><br>
</form>
<script>
document.write(document.getElementById("frm1").acceptCharset)
</script>
</body>
</html>
Examples of the above output:
ISO-8859-1
try it"
Form Object