表单简介:
- 标签名:form
- 用于将数据发送到服务器
-
<form action="服务器地址"></form>
表单项:
- 文本框:
,name作为服务器变量名<input type="text" name="name">
- 密码框:
,name作为服务器变量名<input type="password" name="password">
- 提交按钮:
,value显示在页面上的文字<input type="submit" value="提交">
单选框:
<input type="radio" name="check" value="first" checked> <input type="radio" name="check" value="second" >
,设置相同name可以合并为一个单选框,value作为发送到服务器的值,checked表示默认选中
多选框:
<input type="checkbox" name="checkb" value="1" checked> <input type="checkbox" name="checkb" value="2" checked>
,同单选框类似,都必须设置相同的name,value作为值发送到服务器
下拉列表:
<select name="select" > <option value="1">选项一</option> <option selected value="2">选项二</option> <option value="3">选项三</option> </select>
name发送到服务器的变量名,value发送到服务器的值,selected默认选中。
按钮总结:
<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="color">,ie不支持
邮件框:<input type="email">
相关属性:
autocomplete="off",关闭自动补全
readonly,只读,数据会提交
disabled,禁用,数据不会提交
autofocus,自动获取焦点,刷新页面自动选中