"/>   ">

首页  >  文章  >  web前端  >  在HTML中,将元素所属的表单的名称设置为什么?

在HTML中,将元素所属的表单的名称设置为什么?

WBOY
WBOY转载
2023-09-10 23:13:021105浏览

在HTML中,将元素所属的表单的名称设置为什么?

使用 HTML 中的 form 属性来设置元素在 HTML 中所属的一个或多个表单的名称。

示例

您可以尝试运行以下代码来实现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>

以上是在HTML中,将元素所属的表单的名称设置为什么?的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文转载于:tutorialspoint.com。如有侵权,请联系admin@php.cn删除