4

假设我有该表格包含一些输入:

<form action="demo_post_enctype.asp" method="post" >
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="submit" value="Submit">
</form>

如果我提交此表单:浏览器使用哪种编码类型?

是否有明确定义的默认类型?
还是每个浏览器都选择它自己的编码类型(当然是在三个允许的编码类型中)?

4

2 回答 2

8

这些属性的无效值默认值是application/x-www-form-urlencoded状态。enctype 属性的缺失值默认值也是application/x-www-form-urlencodedstate。(formenctype 属性没有缺失值默认值。)

HTML 5

此属性指定用于将表单提交到服务器的内容类型(当 method 的值为“post”时)。此属性的默认值为“ application/x-www-form-urlencoded”。值 " multipart/form-data" 应与 INPUT 元素 type="file" 结合使用。

HTML 4

这决定了用于对表单内容进行编码的机制。它默认为application/x-www-form-urlencoded.

HTML 3.2

于 2016-10-13T09:30:31.383 回答
2

默认是:“application/x-www-form-urlencoded”,假设我的来源是正确的。

资源

于 2016-10-13T09:31:11.307 回答