提交按钮
提交按钮是一种可用于提交表单的 HTML 元素。原生的提交按钮元素包括:
<button>(其默认type为"submit")- <input type="submit">
- <input type="image">
除了提交表单,提交按钮还可以影响表单的行为和发送的数据。
重写表单的行为
提交按钮可以通过各种属性重写表单的提交行为:
formaction:覆盖表单的action属性。formenctype:覆盖表单的enctype属性。formmethod:覆盖表单的method属性。formnovalidate:覆盖表单的novalidate属性。formtarget:覆盖表单的target属性。
表单数据条目
如果提交按钮是 <button> 或 <input type="submit"> 并且具有 name 属性,表单数据集将包括其 name 和 value 的条目。
如果提交按钮是 <input type="image">,表单数据集将包括用户点击的 X、Y 坐标的条目(如 x=100&y=200 或 buttonName.x=123&buttonName.y=234)。