表单
常用元素
form 表单
input 单行文本输入框,单选框,复选框,按钮等元素
textarea 多行文本
select >option 下拉选择框
button 按钮
lable 表单元素的标题
fieldset 表单的元素组
legend 是fieldset的标题
input
type:
text (默认,文本)
password 密码
radio 单选框
checkbox 复选框
buttton 按钮
reset 重置
submit 提交表单数据给服务器
file 文件上传
fieldset与Legend
input 与 lable
<label for="phone">手机号码</label> <input type="text" id="phone">
outline:外边框
input {
outline:none
}
textarea:
- cols: 列数
- rows: 行数
- 缩放的css设置:
- 禁止缩放: resize: none
- 水平缩放: resize:horizontal
- 垂直缩放:resize: vertical
- 水平垂直缩放: resize:both
select和option
select常见属性:
- multiple:可以多选
- size:显示多少项
option属性:
- selected: 默认选中
form表单提交

name和value的作用
:表单提交时name或value会拼接到URL后面
-
methods :请求方法 (默认get)
- get
- 在url后面以?形式跟上发给服务器的参数,多个参数组件颖&隔开
- 限制,URL后面所带的参数是有限的
- post
- get
-
target: 在什么地方打开URL
-
_blank 新的页面
- _self 本页面
-
-
enctype :规定了在向服务器发送表单数据之前如何对数据进行编码
-
application/x-www-form-urlencoded 默认的
-
multipart/form-data: 文件上产是必须为这个值,并且method必须是post
-
text/plain:普通文本传输
-
-
charset

浙公网安备 33010602011771号