表单的属性
| accept-charset | 规定在被提交表单中使用的字符集(默认:页面字符集)。 |
|---|---|
| action | 规定向何处提交表单的地址(URL)(提交页面)。 |
| autocomplete | 规定浏览器应该自动完成表单(默认:开启)。 |
| enctype | 规定被提交数据的编码(默认:url-encoded)。 |
| method | 规定在提交表单时所用的 HTTP 方法(默认:GET)。 |
| name | 规定识别表单的名称(对于 DOM 使用:document.forms.name)。 |
| novalidate | 规定浏览器不验证表单。 |
| target | 规定 action 属性中地址的目标(默认:_self)。 |
<form action="/api/dataup" method="post">名称: <input type="text" name="" id=""> <br />邮箱: <input type="email" name="" id=""> <br />密码: <input type="password" name="" id=""> <br /><button type="submit">提交</button></form>
input_输入类型
| 属性名 | 输入框的类型 | 说明 |
|---|---|---|
| type | text password checkbox radio color date datetime-local month number range search time url |
文本框 邮箱 密码 复选框 单选框 颜色选择器 日期 日期时间 年月 数字输入框 滑动条 搜索框 时间 URL |
<form action="/api/dataup" method="post">名称: <input type="text" name="" id=""> <br />邮箱: <input type="email" name="" id=""> <br />密码: <input type="password" name="" id=""> <br />复选框: <input type="checkbox" name="age" id=""><input type="checkbox" name="age" id=""> <br />单选框: <input type="radio" name="sex" id=""><input type="radio" name="sex" id=""> <br />颜色选择器: <input type="color" name="" id=""> <br />日期输入框: <input type="date" name="" id=""> <br />日期时间输入框<input type="datetime-local" name="" id=""> <br />年月框: <input type="month" name="" id=""> <br />数字输入框: <input type="number" name="" id=""> <br />滑动条: <input type="range" name="" id=""> <br />搜索框: <input type="search" name="" id=""> <br />时间框: <input type="time" name="" id=""> <br />URL地址框: <input type="url" name="" id=""> <br /><input type="submit" /></form>
input_限制属性
| 属性 | 描述 |
|---|---|
| disabled | 规定输入字段应该被禁用。 |
| max | 规定输入字段的最大值。 |
| maxlength | 规定输入字段的最大字符数。 |
| min | 规定输入字段的最小值。 |
| pattern | 规定通过其检查输入值的正则表达式。 |
| readonly | 规定输入字段为只读(无法修改)。 |
| required | 规定输入字段是必需的(必需填写)。 |
| size | 规定输入字段的宽度(以字符计)。 |
| step | 规定输入字段的合法数字间隔。 |
| value | 规定输入字段的默认值。 |
<input type="text" disabled="disabled" value="000">
