HTML accept-charset 属性

htmlweb developmentfront end technology更新于 2026/1/30 1:16:17

HTML 中的 accept-charset 属性用于设置表单的字符编码。

以下是语法−

<form accept-charset="char_set">

以上 char_set 是一个或多个字符编码的列表。此列表包含以空格分隔的编码。它可以是 Unicode (UTF-8) 或拉丁字母 (ISO-8859-1)。

现在让我们看一个实现 accept-charset 属性的示例 −

示例

<!DOCTYPE html>
<html>
<body>
<h2>Result</h2>
<form action="" accept-charset="ISO-8859-1">
   <label for="stinfo">Student:</label>
   <input type="text" id ="stinfo"><br>
   <label for="sub">Subject:</label>
   <input type="text"><br>
   <label for="rank">Rank:</label>
   <input type="number"><br>
   <label for="marks">Marks:</label>
   <input type="number"><br><br>
   <input type="submit">
</form>
</body>
</html>

输出


相关文章


有用资源