HTML <input> formaction 属性
实例
带有两个提交按钮的 HTML 表单(不同的 action 值):
<form action="demo_form.html">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="submit" value="Submit"><br>
<input type="submit" formaction="demo_admin.html" value="Submit as admin">
</form>
浏览器支持




Internet Explorer 10、Firefox、Opera、Chrome 和 Safari 都支持 formaction 属性。
注意:Internet Explorer 9 及之前的版本不支持 <input> 标签的 formaction 属性。
定义和用法
formaction 属性规定当表单提交时处理输入控件的文件的 URL。
formaction 属性覆盖 <form> 元素的 action 属性。
注释:formaction 属性适用于 type="submit" 和 type="image"。
HTML 4.01 与 HTML5之间的差异
formaction 属性是 HTML5 中的新属性。
语法
属性值
值
|
描述
|
URL
|
规定当表单提交时处理输入控件的文件的 URL。
可能的值:
-
绝对 URL - 某个页面的完整地址(比如 href="http://www.example.com/formresult.html")
-
相对 URL - 指向当前站点内的一个文件(比如 href="formresult.html")
|