以下均用于input type=“格式命值”:
1.email
-----------表示需要输入 e-mail 地址的单行文本框
2.url
-----------表示需要输入URL地址的单行文本框
3.number
-----------表示需要输入数值的单行文本框。 除了例中min,max,name还可以使用step=“数值”(步径),value=“某个值”来表示默认值。
4.range
-----------表示需要输入一定范围内数字值的单行文本框。除了例中min,max,name还可以使用step=“数值”(步径),value=“某个值”来表示默认值。
5.#Date pickers (date, month, week, time, datetime, datetime-local)
date - 选取日、月、年
month - 选取月、年
week - 选取周和年
time - 选取时间(小时和分钟)
datetime - 选取时间、日、月、年(UTC 时间)
datetime-local - 选取时间、日、月、年(本地时间)
-----------表示需要输入日期值的单行文本框,不可以输入,还可以选择。
6.search
7.color
HTML5 表单属性
主要涉及 form 和 input 元素的新属性。
新的 form 属性:
1.autocomplete 是否自动完成,值有on/off
例如:
2.novalidate 自动获得焦点 值就是自己 适用于所有的input标签类型
例如:
新的 input 属性:
1.autocomplete 同上
2.autofocus 同上
3.form 适用于所有 input 标签的类型;必须引用所属表单的 id
例如:
Last name:
注意:上方的last name的输入域在 form 元素之外,但仍然是表单的一部分 因为其form值=id值的
4.form overrides表单重写 (formaction, formenctype, formmethod, formnovalidate, formtarget) 只适用于input类型的submi和image标签
formaction - 重写表单的 action 属性 提交地点
formenctype - 重写表单的 enctype 属性 提交类型
formmethod - 重写表单的 method 属性 提交方式
formnovalidate - 重写表单的 novalidate 属性
formtarget - 重写表单的 target 属性
例如:
5.height 和 width
例如:
6.list 可编辑的下拉列表
7.min max 和 step
min、max 和 step 属性适用于以下类型的 <input> 标签:date pickers、number 以及
range
例如:
8.multiple 多选 适用于input类型的email 和 file标签 值等于自己
----可以多选
9.pattern (regexp)验证 适用于input类型的这些标签:text, search, url, telephone, email 以及 password
pattern="[范围]{条件个数}"
10.placeholder 提示 适用于以下类型的 input>标签:text, search, url, telephone, email 以及 password
例如:
11.required 输入不能为空 值等于自己
例如: