10.1. HTML input 标签
input 标签 -- 代表HTML表单的单行输入域
- input标签是单独出现的,
<input />
- HTML表单的input标签第一课视频教程
- HTML表单的input标签第二课视频教程
- 属性.
- Common -- 一般属性
- type -- 代表一个输入域的显示方式(分为输入型,选择型,点击型)
value
-- 输入域的值size
-- 输入域的长度maxlength
-- 输入域最多可以输入文字的长度- checked -- 如果是选择型的输入域,代表已经被选择
- readonly -- 输入域可以选择,但是无法修改
- disabled -- 输入域无法获得焦点,无法选择,以灰色显示,在表单中不起任何作用
- accesskey -- 表单的快捷键访问方式
- tabindex -- 输入域的"tab"键遍历顺序
src
-- 当使用图片来表示按钮时,代表图片的位置(URI)alt
-- 代表表单的提示文字,当鼠标停留时
示例
<form
id
=
"dreamdu"
action
=
"dreamdu.php"
method
=
"post"
enctype
=
"multipart/form-data"
>
<fieldset>
<legend>
用户名和密码:</legend>
<input
id
=
"hiddenField"
name
=
"hiddenField"
type
=
"hidden"
value
=
"hiddenvalue"
/>
<label
for
=
"username"
>
用户名:</label>
<input
type
=
"text"
id
=
"username"
name
=
"username"
value
=
"dreamdu"
size
=
"15"
maxlength
=
"25"
/>
<label
for
=
"pass"
>
密码:</label>
<input
type
=
"password"
id
=
"pass"
name
=
"pass"
size
=
"15"
maxlength
=
"25"
/>
</fieldset>
<fieldset>
<legend>
性别:</legend>
<label
for
=
"sex"
>
男</label>
<input
type
=
"radio"
value
=
"1"
id
=
"sex"
name
=
"sex"
/>
<label
for
=
"sex"
>
女</label>
<input
type
=
"radio"
value
=
"2"
id
=
"sex"
name
=
"sex"
/>
<label
for
=
"sex"
>
保密</label>
<input
type
=
"radio"
value
=
"3"
id
=
"sex"
name
=
"sex"
/>
</fieldset>
<fieldset>
<legend>
爱好:</legend>
<label
for
=
"fav"
>
计算机</label>
<input
type
=
"checkbox"
value
=
"1"
id
=
"fav"
name
=
"fav"
/>
<label
for
=
"fav"
>
旅游</label>
<input
type
=
"checkbox"
value
=
"2"
id
=
"fav"
name
=
"fav"
/>
<label
for
=
"fav"
>
购物</label>
<input
type
=
"checkbox"
value
=
"3"
id
=
"fav"
name
=
"fav"
/>
</fieldset>
<fieldset>
<legend>
照片:</legend>
<label
for
=
"myimage"
>
个性照片上传</label>
<input
type
=
"file"
id
=
"myimage"
name
=
"myimage"
size
=
"35"
maxlength
=
"255"
/>
</fieldset>
<fieldset>
<legend>
提交:</legend>
<input
type
=
"submit"
value
=
"submit"
id
=
"submit"
name
=
"submit"
/>
<input
type
=
"reset"
value
=
"reset"
id
=
"reset"
name
=
"reset"
/>
</fieldset>
</form>
HTML input 标签示例 -- 可以尝试编辑
说明
id
属性,标识了一个input
标签,此属性包含在Common属性中.