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

原创
ithorizon 5个月前 (10-19) 阅读数 42 #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中,将元素所属的表单的名称设置为什么?的详细内容,更多请关注IT视界其它相关文章!



热门