HTML <button> formaction 屬性
示例
一個帶有兩個提交按鈕的表單。第一個提交按鈕將表單資料提交到 "action_page.php",第二個提交到 "action_page2.php"
<form action="/action_page.php" method="get">
<label for="fname">名:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">姓氏:</label>
<input type="text" id="lname" name="lname"><br><br>
<button type="submit">提交</button>
<button type="submit" formaction="/action_page2.php">提交到另一個頁面</button>
</form>
自己動手試一試 »
定義和用法
formaction
屬性指定了在提交表單時將表單資料傳送到何處。此屬性會覆蓋表單的 action
屬性。
formaction
屬性僅用於 type="submit"
的按鈕。
瀏覽器支援
表格中的數字表示完全支援該屬性的第一個瀏覽器版本。
Attribute | |||||
---|---|---|---|---|---|
formaction | 9.0 | 10.0 | 4.0 | 5.1 | 15.0 |
語法
<button type="submit" formaction="URL">
屬性值
值 | 描述 |
---|---|
URL | 指定將表單資料傳送到何處。 可能的值
|
❮ HTML <button> 標籤