正在加载...
HTML input 类型
One tag — input — many behaviors. The type attribute chooses the control style and hints the expected value.
直接回答
Set type to text, email, password, number, checkbox, radio, date, file, hidden, or submit. Pair visible inputs with label. Phones may show special keyboards for email and number.
📊 入门 input 类型
| type | Use |
|---|---|
| text | General single-line text |
| Email addresses | |
| password | Masked secrets |
| number | Numeric values |
| checkbox | On/off options (many can be checked) |
| radio | Pick one from a named group |
| date | Calendar date |
| file | Upload a file |
| submit | Submit button-style input (or prefer button) |
Several input types
html
HTML Code
<form action="/join" method="post">
<label for="mail">Email</label>
<input id="mail" name="mail" type="email">
<label for="pw">Password</label>
<input id="pw" name="pw" type="password">
<label><input type="checkbox" name="news" value="yes"> Newsletter</label>
<label><input type="radio" name="plan" value="free"> Free</label>
<label><input type="radio" name="plan" value="pro"> Pro</label>
<button type="submit">Join</button>
</form>
试一试
- email + password form
- checkbox + radio group same name
- submit locally
- try number for age
常见错误
- radios different names
- text for passwords
- missing checkbox labels
小结
- type selects behavior
- match type to data
- radios share name
- label visible inputs
🧠 测试您的知识
准备开始
测试您的知识
通过这个互动测验挑战自己,看看你对这个主题的理解程度如何
6
问题
70%
及格要求
∞
时间
∞
尝试次数
📝 说明
- 仔细阅读每个问题
- 为每个问题选择最佳答案
- 您可以随时重新参加测验
- 您的进度将显示在顶部