您的位置:首页 > Web前端 > HTML

HTML表单学习3——输入类型

2016-12-27 17:30 387 查看
HTML表单学习3——输入类型补充
在HTML表单学习1中已经学习了几个,在本文将做一个补充!
 
1,输入类型:password
<input type=”password”>
定义密码字段
例子:

用户名:
<input  type=”text” name=”username” >
<br>
密码:
<input  type=”password” name=”psw”>
<br>


 
2,输入类型:checkbox
<input type=”checkbox”>定义复选框
例子:

<input type=”checkbox” name=”class” value=”Chinese”>
语文课
<br>
<input type=”checkbox” name=”class” value=”math”>
数学课
<br>


 
3,输入类型:number
<input type=”number”>能对数字大小进行限制
例子:
<input type=”number” min=”1 max=”10”>
输入限制:
 disabled
规定输入字段应该被禁用。
max
规定输入字段的最大值。
maxlength
规定输入字段的最大字符数。
min
规定输入字段的最小值。
pattern
规定通过其检查输入值的正则表达式。
readonly
规定输入字段为只读(无法修改)。
required
规定输入字段是必需的(必需填写)。
size
规定输入字段的宽度(以字符计)。
step
规定输入字段的合法数字间隔。
value
规定输入字段的默认值。
 
4,输入类型:data
<input type=”data”>
例子:
<input type=”data” name=”birthday>
 
5,输入类型:color
<input type=”color”>
用于颜色输入
例子:
<input type=”color” name=”color>
 
6,输入类型:rang
<input type=”rang”>用于包含一定范围内的数字输入字段
例子:
<input type=”rang” name=”point” min=”0” max=”10”>
 
7,输入类型:month
<input type="month">允许用户选择月份和年份
例子:
<input type="month" name="bdaymonth">
 
8,输入类型:week
<input type="week">允许用户选择周和年
例子:
<input type="week" name="bdayweek">

 
9,输入类型:time
<input type="time">允许用户选择时间
例子:
<input type="time" name="usr_time">
 
10,输入类型:datetime
<input type="datetime" >允许用户选择日期和时间
例子:
<input type="datetime" name="bdaytime1">
 
11,输入类型:datetime-local
<input type="datetime-local">允许用户选择日期和时间
例子:
<input type="datetime-local" name="bdaytime2">
 
12,输入类型:email
<input type="email">用于包含电子邮件的字段
例子:
<input type="email" name="email">
 
13,输入类型:search
<input type="search">用于搜索字段
例子:
<input type="search" name="googlesearch">
 
14,输入类型:url
<input type="url">用于包含url地址的字段
例子:
<input type="url" name="urlpage">
 
完!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: