如何在 HTML 中使用 formmethod 屬性?


formmethod 屬性用於定義用於傳送表單資訊的方法。此方法用於型別為“提交”的輸入圖片。它會覆蓋 HTML 表單的 method 屬性。

示例

你可以嘗試執行以下程式碼以瞭解如何在 HTML 中使用 formmethod 屬性。

<!DOCTYPE html>
<html>
   <head>
      <title>HTML formmethod attribute</title>
   </head>
   <body>
      <form action=”/new.php” method="get">
         Student Name<br><input type="text" name="name"/><br>
         Student Subject<br><input type="text" name="subject"/><br>
         <input type="submit" value="Submit">
         <input type="submit" formmethod=”post” formaction=”/new2.php” value="Submit">
      </form>
   </body>
</html>

更新於: 2020 年 5 月 14 日

129 次瀏覽

開啟你的 職業生涯

透過完成課程獲得認證

開始
廣告
© . All rights reserved.