带有两个提交按钮的表单。 第一个提交按钮将表单数据提交到 action_page.php,第二个提交到 action_page2.php:
<form action="/action_page.php" method="get"> <label for="fname">First name:</label> <input type="text" id="fname" name="fname"><br><br> <label for="lname">Last name:</label> <input type="text" id="lname" name="lname"><br><br> <button type="submit">Submit</button> <button type="submit" formaction="/action_page2.php">Submit to another page</button> </form>
formaction 属性指定提交表单时将表单数据发送到何处。 此属性覆盖表单的 action 属性。
formaction 属性仅用于具有 type="submit" 的按钮。
表中的数字指定了完全支持该属性的第一个浏览器版本。
| 属性 Attribute |
|
|
|
|
|
|---|---|---|---|---|---|
| formaction | 9.0 | 10.0 | 4.0 | 5.1 | 15.0 |
<button type="submit" formaction="URL">
| 值 Value | 描述 Description |
|---|---|
| URL | 指定发送表单数据的位置。可能的值: * 绝对 URL - 页面的完整地址(如 href="http://www.example.com/formresult.asp")* 相对 URL - 指向当前站点内的文件(如 href="formresult.asp") |