一、form表单是在网站制做中经常使用到的功能,例如用户名的注册,简历的制做等都会用到form表单。html
二、form表单的基本属性主要是method,action,target,它们分别表明表单传输的方法,提交给某个页面,在哪一个页面打开。method又分为get和post两种方式。target能够选择_black和_self,分别表明在另外一个空白页面和在原本的页面打开。代码以下:post
<form method="get" action="Untitled-2.html" target="_blank">网站
<form method="post" action="Untitled-2.html" target="_self">orm
三、表单的文本标签包括type,name,value,textarea,maxlength,type属性有text,password,hidden。textarea是文本领域的意思,它常常用到的属性是rows.表明能够写几行。代码以下:htm
用户名:
<input type="text" name="user" placeholder="提示文字" />
<br />
密码:
<input type="password" maxlength="2" name="pwd" />对象
四、表单的按钮标签包括submit(提交),reset(重置),image(图片),button(按钮)。代码以下:图片
<input type="submit" value="注册"/>
<input type="reset" value="重置" />
<input type="image" src="斜眼狗.jpg" />
<input type="button" value="按钮" onclick="alert('啊哈')" />get
五、表单中经常用到单选或复选的模式,如性别,出生日期等,选择的标签有radio(单选),checkbox(复选),select(下拉)。input
radio的name属性要相同,分为两组,value用以区分两组的对象。chekbox的name属性和value属性都不能相同,radio和chekbox还能够添加label属性,label后边必须跟for,意思是把……称为,代码以下:it
<input type="radio" name="sex" value="1" id="s1"/><label for="s1">男</label>
<input type="radio" name="sex" value="0" id="s0" /><label for="s0">女</label>
<input type="checkbox" name="c1" id="c1"value="v1" /><label for="c1">足球</label>
<input type="checkbox" name="c2" id="c2"value="v2" /><label for="c2">篮球</label>
六、form表单还有一些比较经常使用的其它属性,如readonly(只读),disable(使……不可能),hidden(隐藏),checked(规定在页面加载时应该被预先选定的 input 元素),selected(被预选的选项会显示在下拉列表最前面的位置),代码以下:
<input type="text" name="login" value="abc-123" readonly="readonly" />
<input type="text" name="login" value="abc-123" disabled="disabled" />
<input type="hidden" name="yc" value="zhi" />
<option value="25501">桓台</option> <option value="25502">高青</option> <option value="25503" selected="selected">沂源</option>