“HTML Form表单”的版本间差异

本页内容
无编辑摘要
Neo讨论 | 贡献
第22行: 第22行:
</form>
</form>
</html>
</html>
</sample>
== <nowiki><form></nowiki> 元素 ==
<nowiki><form></nowiki>元素用于为用户输入创建 HTML 表单:
<sample title="" desc="">
<form>
.
form elements
.
</form>
</sample>
<nowiki><form></nowiki>的元素是不同类型输入元素的容器,例如:文本字段、复选框、单选按钮、提交按钮等。
== <nowiki><input></nowiki> 元素 ==
HTML<nowiki><input></nowiki>元素是最常用的表单元素。
一个<nowiki><input></nowiki>元素可以通过多种方式显示,具体取决于type 属性。
* <nowiki><input type="text"></nowiki> 显示单行文本输入字段
* <nowiki><input type="radio"></nowiki> 显示一个单选按钮
* <nowiki><input type="checkbox"></nowiki> 显示一个复选框
* <nowiki><input type="submit"></nowiki> 显示提交按钮
* <nowiki><input type="button"></nowiki> 显示一个可点击按钮
<sample title="" desc="" hererun="s3">
<form action="/third/http.php" method="GET">
  <label for="fname">姓名:</label><br>
  <input type="text" id="fname" name="fname" value="小白"><br>
  <label for="age">性别:</label><br>
<input type="radio" name='gender' value="女">
<input type="radio" name='gender' value="男">
  <input type="submit" value="提交">
</form>
</sample>
</sample>

2022年8月14日 (日) 20:12的版本

HTML 表单用于收集用户输入。用户输入常被发送到服务器进行处理。

试试看







示例

<html>
<form action="/third/http.php" method="GET">
  <label for="fname">姓名:</label><br>
  <input type="text" id="fname" name="fname" value="小白"><br>
  <label for="age">年龄:</label><br>
  <input type="text" id="age" name="age" value="1"><br><br>
  <input type="submit" value="提交">
</form>
</html>

<form> 元素

<form>元素用于为用户输入创建 HTML 表单:


示例

<form>
.
form elements
.
</form>

<form>的元素是不同类型输入元素的容器,例如:文本字段、复选框、单选按钮、提交按钮等。

<input> 元素

HTML<input>元素是最常用的表单元素。

一个<input>元素可以通过多种方式显示,具体取决于type 属性。

  • <input type="text"> 显示单行文本输入字段
  • <input type="radio"> 显示一个单选按钮
  • <input type="checkbox"> 显示一个复选框
  • <input type="submit"> 显示提交按钮
  • <input type="button"> 显示一个可点击按钮


示例

<form action="/third/http.php" method="GET">
  <label for="fname">姓名:</label><br>
  <input type="text" id="fname" name="fname" value="小白"><br>
  <label for="age">性别:</label><br>
<input type="radio" name='gender' value="女">
<input type="radio" name='gender' value="男">
  <input type="submit" value="提交">
</form>
此页面最后编辑于2022年8月14日 (星期日) 20:12。