标签:
form标签
<
form
id
=
"
dreamduform
"
method
=
"
post
"
action
=
"
dreamdu.php
"
>
用户名:
<
input
type
=
"
text
"
id
=
"
username
"
name
=
"
username
"
/>
密码:
<
input
type
=
"
password
"
id
=
"
pass
"
name
=
"
pass
"
/>
</
form
>
<input />
<
form
id
=
"
dreamdu
"
action
=
"
dreamdu.php
"
method
=
"
post
"
enctype
=
"
multipart/form-data
"
>
<
input
id
=
"
hiddenField
"
name
=
"
hiddenField
"
type
=
"
hidden
"
value
=
"
hiddenvalue
"
/>
用户名和密码:
用户名:
<
input
type
=
"
text
"
id
=
"
username
"
name
=
"
username
"
value
=
"
dreamdu
"
size
=
"
15
"
maxlength
=
"
25
"
/>
密码:
<
input
type
=
"
password
"
id
=
"
pass
"
name
=
"
pass
"
size
=
"
15
"
maxlength
=
"
25
"
/>
网站建设服务:
注册域名
<
input
type
=
"
radio
"
value
=
"
注册域名
"
id
=
"
service1
"
name
=
"
service
"
/>
购买空间
<
input
type
=
"
radio
"
value
=
"
购买空间
"
id
=
"
service2
"
name
=
"
service
"
/>
购买云主机
<
input
type
=
"
radio
"
value
=
"
购买云主机
"
id
=
"
service3
"
name
=
"
service
"
/>
网站定位与策划
<
input
type
=
"
radio
"
value
=
"
网站定位与策划
"
id
=
"
service4
"
name
=
"
service
"
/>
网站建设与制作
<
input
type
=
"
radio
"
value
=
"
网站建设与制作
"
id
=
"
service5
"
name
=
"
service
"
/>
网站推广
<
input
type
=
"
radio
"
value
=
"
网站推广
"
id
=
"
service6
"
name
=
"
service
"
/>
网站运营
<
input
type
=
"
radio
"
value
=
"
网站运营
"
id
=
"
service7
"
name
=
"
service
"
/>
SEO服务
<
input
type
=
"
radio
"
value
=
"
SEO服务
"
id
=
"
service8
"
name
=
"
service
"
/>
个人发展方向:
游戏人生
<
input
type
=
"
checkbox
"
value
=
"
游戏人生
"
id
=
"
direction1
"
name
=
"
direction1
"
/>
美工设计
<
input
type
=
"
checkbox
"
value
=
"
美工设计
"
id
=
"
direction2
"
name
=
"
direction2
"
/>
编程开发
<
input
type
=
"
checkbox
"
value
=
"
编程开发
"
id
=
"
direction3
"
name
=
"
direction3
"
/>
运营与管理
<
input
type
=
"
checkbox
"
value
=
"
运营与管理
"
id
=
"
direction4
"
name
=
"
direction4
"
/>
创业
<
input
type
=
"
checkbox
"
value
=
"
创业
"
id
=
"
direction5
"
name
=
"
direction5
"
/>
照片:
个性照片上传:
<
input
type
=
"
file
"
id
=
"
myimage
"
name
=
"
myimage
"
size
=
"
35
"
maxlength
=
"
255
"
/>
</
form
>
type 属性 -- 代表HTML表单,单行输入域(框)的表现方式
HTML checked 属性
<
form
id
=
"
dreamduform
"
action
=
"
dreamdu.php
"
method
=
"
post
"
>
计算机
<
input
type
=
"
checkbox
"
value
=
"
1
"
id
=
"
fav1
"
name
=
"
fav1
"
/>
旅游
<
input
type
=
"
checkbox
"
value
=
"
2
"
id
=
"
fav2
"
name
=
"
fav2
"
/>
购物
<
input
type
=
"
checkbox
"
value
=
"
3
"
id
=
"
fav3
"
name
=
"
fav3
"
checked
=
"
checked
"
/>
</
form
>
HTML disabled 属性
<
form
id
=
"
dreamduform
"
action
=
"
dreamdu.php
"
method
=
"
post
"
>
计算机
<
input
type
=
"
checkbox
"
value
=
"
1
"
id
=
"
fav1
"
name
=
"
fav1
"
/>
旅游
<
input
type
=
"
checkbox
"
value
=
"
2
"
id
=
"
fav2
"
name
=
"
fav2
"
disabled
=
"
disabled
"
/>
购物
<
input
type
=
"
checkbox
"
value
=
"
3
"
id
=
"
fav3
"
name
=
"
fav3
"
/>
</
form
>
HTML readonly 属性
<
form
id
=
"
dreamduform
"
action
=
"
dreamdu.php
"
method
=
"
post
"
>
单行输入域:
无法输入的单行输入框
<
input
id
=
"
notinput
"
name
=
"
notinput
"
type
=
"
text
"
value
=
"
梦之都
"
readonly
=
"
readonly
"
/>
多行输入域:
无法输入的多行输入框
<
textarea
cols
=
"
50
"
rows
=
"
10
"
id
=
"
textarea
"
name
=
"
textarea
"
readonly
=
"
readonly
"
>
梦之都
</
textarea
>
</
form
>
HTML textarea 标签
<
form
id
=
"
dreamduform
"
action
=
"
dreamdu.php
"
method
=
"
post
"
>
联系我们
<
textarea
cols
=
"
50
"
rows
=
"
10
"
id
=
"
contactus
"
name
=
"
contactus
"
>
可爱的猴子
</
textarea
>
</
form
>
HTML select 标签 -- 列表选择
select标签创建了一个菜单。菜单里的选项通过option标签指定。一个select元素内部,必须包含一个option元素
当设置multiple属性后,菜单可多选,否则只能单选
多选菜单,可按住"Ctrl"键,同时点击选择项进行多选,或者按住"Shift"进行连续多选
<
form
id
=
"
dreamduform
"
action
=
"
dreamdu.php
"
method
=
"
post
"
>
你对梦之都的感觉:
<
select
size
=
"
1
"
id
=
"
select
"
name
=
"
select
"
>
<
option
>
很全面,很好
</
option
>
</
select
>
你想在梦之都学习的编程语言:
<
select
size
=
"
10
"
multiple
=
"
multiple
"
id
=
"
multipleselect
"
name
=
"
multipleselect[]
"
>
<
option
>
XHTML
</
option
>
</
select
>
</
form
>
HTML option 标签
<
form
action
=
"
dreamdu.php
"
method
=
"
post
"
id
=
"
dreamduform
"
>
你对梦之都的感觉:
<
select
size
=
"
1
"
id
=
"
select
"
name
=
"
select
"
>
<
option
value
=
"
best
"
>
很全面,很好
</
option
>
<
option
value
=
"
better
"
>
一般般吧,还要努力
</
option
>
<
option
value
=
"
good
"
>
有很多问题,不过还可以
</
option
>
</
select
>
你想在梦之都学习的编程语言:
<
select
size
=
"
10
"
multiple
=
"
multiple
"
id
=
"
multipleselect
"
name
=
"
multipleselect[]
"
>
<
option
value
=
"
1
"
>
XHTML
</
option
>
<
option
value
=
"
2
"
selected
=
"
selected
"
>
CSS
</
option
>
<
option
value
=
"
3
"
>
JAVASCRIPT
</
option
>
<
option
>
XML
</
option
>
<
option
value
=
"
5
"
>
PHP
</
option
>
<
option
value
=
"
6
"
>
C#
</
option
>
<
option
value
=
"
7
"
selected
=
"
selected
"
>
JAVA
</
option
>
<
option
value
=
"
8
"
>
C++
</
option
>
<
option
value
=
"
9
"
>
PERL
</
option
>
</
select
>
</
form
>
HTML optgroup 标签
<
form
action
=
"
dreamdu.php
"
method
=
"
post
"
id
=
"
dreamduform
"
>
选择一个你在梦之都最想学的
<
select
id
=
"
WebDesign
"
name
=
"
WebDesign
"
>
<
optgroup
label
=
"
client
"
>
<
option
value
=
"
HTML
"
>
HTML
</
option
>
<
option
value
=
"
CSS
"
>
CSS
</
option
>
<
option
value
=
"
javascript
"
>
javascript
</
option
>
</
optgroup
>
<
optgroup
label
=
"
server
"
>
<
option
value
=
"
PHP
"
>
PHP
</
option
>
<
option
value
=
"
ASP
"
>
ASP
</
option
>
<
option
value
=
"
JSP
"
>
JSP
</
option
>
</
optgroup
>
<
optgroup
label
=
"
database
"
>
<
option
value
=
"
Access
"
>
Access
</
option
>
<
option
value
=
"
MySQL
"
>
MySQL
</
option
>
<
option
value
=
"
SQLServer
"
>
SQLServer
</
option
>
</
optgroup
>
</
select
>
</
form
>
HTML label 标签
label标签入门示例
下面示例显示了一个文本输入框、一个密码输入框和两个选择按钮,注意:</label>
的位置:
<
label
for
=
"
username
"
>
用户名
</
label
>
<
input
type
=
"
text
"
id
=
"
username
"
name
=
"
username
"
value
=
"
dreamdu
"
size
=
"
15
"
maxlength
=
"
25
"
/>
<
label
for
=
"
pass
"
>
密码
<
input
type
=
"
password
"
id
=
"
pass
"
name
=
"
pass
"
size
=
"
15
"
maxlength
=
"
25
"
/>
</
label
>
网站建设服务:
<
label
for
=
"
service1
"
>
注册域名
</
label
>
<
input
type
=
"
radio
"
value
=
"
注册域名
"
id
=
"
service1
"
name
=
"
service
"
/>
<
label
for
=
"
service2
"
>
购买空间
<
input
type
=
"
radio
"
value
=
"
购买空间
"
id
=
"
service2
"
name
=
"
service
"
/>
</
label
>
尝试点击下面示例中的“用户名”、“注册域名”、“购买空间”文字,查看效果
使用label标签的for属性关联一个表单元素
标签可以被某些可视化浏览器渲染成可以点击的,点击后光标会显示在关联的表单元素内
HTML fieldset 标签 -- 表单分组
如果一个页面的表单项太多,我们最好把它们分组显示,就像使用p
标签分开段落一样,可以使用fieldset
与legend
标签对表单内容分组.
<
form
action
=
"
dreamdu.php
"
method
=
"
post
"
id
=
"
dreamduform
"
>
<
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
"
/>
<
label
for
=
"
pass
"
>
密码:
</
label
>
<
input
type
=
"
password
"
id
=
"
pass
"
name
=
"
pass
"
/>
</
fieldset
>
<
fieldset
>
<
legend
>
性别:
</
legend
>
<
label
for
=
"
boy
"
>
男
</
label
>
<
input
type
=
"
radio
"
value
=
"
1
"
id
=
"
sex
"
name
=
"
sex
"
/>
<
label
for
=
"
girl
"
>
女
</
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
=
"
computer
"
>
计算机
</
label
>
<
input
type
=
"
checkbox
"
value
=
"
1
"
id
=
"
fav
"
name
=
"
fav
"
/>
<
label
for
=
"
trval
"
>
旅游
</
label
>
<
input
type
=
"
checkbox
"
value
=
"
2
"
id
=
"
fav
"
name
=
"
fav
"
/>
<
label
for
=
"
buy
"
>
购物
</
label
>
<
input
type
=
"
checkbox
"
value
=
"
3
"
id
=
"
fav
"
name
=
"
fav
"
/>
</
fieldset
>
<
fieldset
>
<
legend
>
对梦之都的意见:
</
legend
>
<
label
for
=
"
select
"
>
你对梦之都的感觉
</
label
>
<
select
size
=
"
1
"
id
=
"
select
"
name
=
"
select
"
>
<
option
>
很全面,很好
</
option
>
<
option
>
一般般吧,还要努力
</
option
>
<
option
>
有很多问题,不过还可以
</
option
>
</
select
>
</
fieldset
>
<
fieldset
>
<
legend
>
梦之都编程语言选择:
</
legend
>
<
label
for
=
"
multipleselect
"
>
你想在梦之都学习的编程语言
</
label
>
<
select
size
=
"
10
"
multiple
=
"
multiple
"
id
=
"
multipleselect
"
name
=
"
multipleselect
"
>
<
option
>
XHTML
</
option
>
<
option
>
CSS
</
option
>
<
option
>
JAVASCRIPT
</
option
>
<
option
>
XML
</
option
>
<
option
>
PHP
</
option
>
<
option
>
C#
</
option
>
<
option
>
JAVA
</
option
>
<
option
>
C++
</
option
>
<
option
>
PERL
</
option
>
</
select
>
</
fieldset
>
<
fieldset
>
<
legend
>
我要在梦之都学:
</
legend
>
<
label
for
=
"
WebDesign
"
>
选择一个你在梦之都最想学的
</
label
>
<
select
id
=
"
WebDesign
"
name
=
"
WebDesign
"
>
<
optgroup
label
=
"
client
"
>
<
option
value
=
"
HTML
"
>
HTML
</
option
>
<
option
value
=
"
CSS
"
>
CSS
</
option
>
<
option
value
=
"
javascript
"
>
javascript
</
option
>
</
optgroup
>
<
optgroup
label
=
"
server
"
>
<
option
value
=
"
PHP
"
>
PHP
</
option
>
<
option
value
=
"
ASP
"
>
ASP
</
option
>
<
option
value
=
"
JSP
"
>
JSP
</
option
>
</
optgroup
>
<
optgroup
label
=
"
database
"
>
<
option
value
=
"
Access
"
>
Access
</
option
>
<
option
value
=
"
MySQL
"
>
MySQL
</
option
>
<
option
value
=
"
SQLServer
"
>
SQLServer
</
option
>
</
optgroup
>
</
select
>
</
fieldset
>
<
fieldset
>
<
legend
>
个人化信息:
</
legend
>
<
label
for
=
"
myimage
"
>
个性照片上传
</
label
>
<
input
type
=
"
file
"
id
=
"
myimage
"
name
=
"
myimage
"
size
=
"
35
"
maxlength
=
"
255
"
/>
<
label
for
=
"
contactus
"
>
联系我们
</
label
>
<
textarea
cols
=
"
50
"
rows
=
"
10
"
id
=
"
contactus
"
name
=
"
contactus
"
>
可爱的猴子
</
textarea
>
</
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 legend 标签
标签:
原文地址:http://www.cnblogs.com/JSWBK/p/5600552.html