表单结构
<form>...</form>
属性名称 | 属性值 | 说明 |
---|---|---|
name | string | 字符串,给这个表单起个名字 |
method | get/post | 表单的传输方式 |
action | url | 路径,传输目标 |
标题:<label>标签
文本栏:<input type="text" >
密码栏: <input type="password" >
隐藏性栏位:<input type="hidden" >
属性名称 | 说明 |
---|---|
name | 栏位名称 |
value | 栏位内定值 |
size | 栏位显示宽度 |
maxlength | 栏位数据输入最大长度 |
placeholder | 隐身字 |
readonly | 只读,禁止写 |
disabled | 禁用 |
复选框(多选):<input type=”checkbox”>
单选框:<input type="radio">
属性名称 | 说明 |
---|---|
name | 栏位名称 |
value | 内定值 |
checked | 默认选择 |
disabled | 禁止选择 |
窗体栏位(下拉菜单):
<select name=”栏位名称” size=”数字” >
<option value="选项值" selected="selected"(默认选择)>
<option value="选项值">
</select>
区块栏位(文本域):
<textarea cols=”设置长度” rows=”设置高度”></textarea>
图像按钮:
<input type="image" src="url(路径)" alt="文本"/>
按钮图像:
<button name=”栏位名称” type=”图象形态”>
<img src=”URL(路径)”>
</button>
提交按钮:
<input type=”submit” value=”按钮中显示的文字”>
<button type=”submit”>...</button>
重置按钮:
<input type=”reset” value=”按钮中显示的文字”>
<button type=”reset”>...</button>
普通按钮:
<input type=”button” value=”按钮中显示的文字”>
<button type=”button”>...</button>
上传文件:
<input type="file" name="file">
(注意:如果定义了上传框form表单必须定义enctype=“multipart/form-data”,否则将接受不到上传的图片信息)
表单加上外框和标题
外边框:<fieldset>...</fieldset>
标题:<legend>...</legend>