HTML标签 formenctype 属性
定义和用法
formenctype 属性覆盖 form 元素的 enctype 属性。
formenctype 属性与 type="submit" 配合使用。
浏览器支持
Internet Explorer 10, Firefox, Opera, Chrome, 和 Safari 支持 formenctype属性。
注意: Internet Explorer 9 及更早IE版本不支持 formenctype属性。
HTML 4.01 与 HTML 5 之间的差异
formenctype 属性是 HTML 5 中的新属性。
语法
属性值
值
描述
application/x-www-form-urlencoded
在发送前对所有字符进行编码(默认)。
multipart/form-data
不对字符编码。当使用有文件上传控件的表单时,该值是必需的。
text/plain
将空格转换为 "+" 符号,但不编码特殊字符。
实例
带有两个提交按钮的表单(带有不同的编码方式):
HTML button 标签 formenctype 属性 xinbiancheng.cnName:
使用编码提交
不使用编码提交
注意: Internet Explorer 9 及更早 IE 版本不支持 formenctype 属性。
输出:
Name:
使用编码提交
不使用编码提交
注意: Internet Explorer 9 及更早 IE 版本不支持 formenctype 属性。