form表单

表单标签form包含

   1222补充:在单选,多选中checked=“checked”为默认选项。

                   disablad=“disablad”不可取消

                   placeholder无法选中的默认值;备注

                   required非空验证

                   label fol=“id”通过他找到表单里的id,输入字,点字即点圈

1.文本输入

输入标签input,type输入的格式,value为默认值(默认文字是什么)

文本框text,如账号框<input type="text" placeholder="输入帐号/>

密码框password;如密码框<input type="password" placeholder="输入账号"/>

(其中placeholder为等待输入)

文本区域textarea,成对出现,其中cols为一行有多少字符,rows为几行字符;如<textarea cols="10" rows="2"></textarea>

(一行十个字符,可显示两行)

强制要求输入required

*隐藏域hidden

2.按钮

提交按钮submit,<input type="submit" value="提交"/>(默认显示提交)(提交作用即是提交整个form内的内容) 

重置按钮reset<input type="reset" value="重置"/>(刷新)

普通按钮,登录按钮button必须设置名称<input type="button" valud="登入"/>(value)

图片按钮image<input type="image" src="******"/>(效果同提交一样)

锁定按钮文本disabled<input type="text" value="邵轩轩"/>(锁定邵轩轩)(使按钮,文本框锁定)

3.选择输入

单选redio“需要分组”

男神<input type="redio name="***"/>

女汉子<input type="redio name="***"/>

多选(复选)checkbox

<input type="checkbox"/>金钱<br/>
<input type="checkbox"/>名利<br/>
<input type="checkbox"/>妹子

*文件上传(游览)file<input type="file" />

4.下拉列表框select

<select size="1">(其中size=1时为下拉列表框,大于1时为列表,通常为1)
<option>金钱</optron>
<option>名利</optron>
<option>妹子</optron>
</select>

上图!

简单的注册界面

代码!

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body bottommargin="300" bgcolor="#00CCCC">
<center><form><table width="800" height="550" border="0" cellpadding="0" cellspacing="0">
<tr height="50">
<td width="200" colspan="2"></td>

</tr>
<tr height="50">
<td width="200"><b>邮箱</b></td>
<td width="600"><input type="text"/></td>
</tr>
<tr height="30">
<td colspan="2"><font color="#666666" size="-3">需要通过邮箱激活用户,不支持sohu,21cn,sougou的邮箱</font></td>

</tr>
<tr height="50">
<td><b>登入用户名</b></td>
<td><input type="text"/></td>
</tr>
<tr height="30">
<td colspan="2"><font color="#666666" size="-3">仅在登入时使用,字符不少于4个</font></td>

</tr>
<tr height="50">
<td><b>显示名称</b></td>
<td><input type="text"/></td>
</tr>
<tr height="30">
<td colspan="2"><font color="#666666" size="-3">即昵称,字符数不少于2个</font></td>

</tr>
<tr height="50">
<td><b>密码</b></td>
<td><input type="text"/></td>
</tr>
<tr height="50">
<td><b>确认密码</b></td>
<td><input type="text"/></td>
</tr>
<tr height="30">
<td colspan="2"><font color="#666666" size="-3">至少8位,必须包括字母,数字,特殊字符</font></td>

</tr>
<tr height="50">
<td><b>性别</b></td>
<td><input type="radio" name="111" checked="checked"/><input type="radio" name="111" checked="checked"/></td>
</tr>
<tr height="50">
<td><b>喜好</b></td>
<td><input type="checkbox" checked="checked" />听音乐<br />
<input type="checkbox" checked="checked" />遛弯<br />
<input type="checkbox" checked="checked" />看电影</td>
</tr>
<tr height="30">
<td colspan="2"><input type="submit" value="提交" /><br />
<input type="reset"  value="重置" /></td>

</tr>

</table></form></center>

</body>
</html>
原文地址:https://www.cnblogs.com/xuan584521/p/6079383.html