在 HTML 中設定元素所屬的表單名稱?


在 HTML 中使用 form 屬性來設定元素所屬的表單名稱。

示例

你可以嘗試執行以下程式碼來實現 form 屬性 −

<!DOCTYPE html>
<html>
   <body>
      <form action = "" method = "get" id = "myform">
         SubjectID: <input type = "number" name = "subid"><br>
         Subject Name: <input type = "text" name = "subname"><br>
         Total Students: <input type="number" name = "stcount"><br>
      </form>
      <button type = "submit" form = "myform" value = "Submit">Click</button>
   </body>
</html>

更新日期:30-May-2020

97 次瀏覽

開啟您的 職業生涯

完成課程以獲得認證

開始學習
廣告
© . All rights reserved.