常见的表单元素的类型:
text:单行文本框
password:密码文本框
radio:单选按钮
checkbox:复选框
submit:提交按钮
reset: 重置按钮
button:一般按钮
file:文件域
hidden:隐藏域
<input type=“表单元素的类型” name=“名称” id=“” value=“” />
以下是HTML中的一些常用表单元素类型:
1. `<input type="text">`:用于输入文本内容;
2. `<input type="email">`:用于输入邮箱地址;
3. `<input type="password">`:用于输入密码,内容会被隐藏;
4. `<input type="checkbox">`:用于选择多个选项,可以选择多个选项;
5. `<input type="radio">`:用于选择单个选项,只能选择一个选项;
6. `<select>`:用于创建下拉列表;
7. `<option>`:用于定义下拉列表中的选项;
8. `<textarea>`:用于输入大量文本内容;
9. `<button>`:用于定义按钮,可用 JavaScript 来定义按钮的行为 ; 10.`<hidden>`:隐藏域。
除了以上常见的表单元素类型,还有其他一些用途更为特殊的表单元素,例如:
1. `<input type="file">`:用于上传文件;
2. `<input type="date">`:用于输入日期;
3. `<input type="color">`:用于选择颜色;
4. `<input type="number">`:用于输入数字;
5. `<input type="range">`:用于选择一个值的范围;
6. `<progress>`:用于表示任务的完成进度;
7. `<meter>`:用于表示一段比例关系。
元素类型 | 描述 |
input type="text" | 文本输入 |
input type="password" | 密码输入 |
input type="number" | 数字输入 |
input type="email" | 电子邮件输入 |
input type="date" | 日期输入 |
input type="time" | 时间输入 |
input type="checkbox" | 多选框 |
input type="radio" | 单选框 |
input type="file" | 文件上传 |
input type="submit" | 提交按钮 |
input type="reset" | 重置按钮 |
input type="button" | 普通按钮 |
textarea | 多行文本输入 |
select | 下拉列表选择 |
optgroup | 分组选项 |
option | 下拉列表选项 |
button | 按钮 |
datalist | 列表选项 |
keygen | 密钥生成 |
meter | 表示标量测量 |
progress | 表示任务进度 |
output | 表示输出结果 |