您的位置:首页 > Web前端 > HTML

HTML-form表单的学习

2013-03-04 15:38 246 查看
今天主要学习form表单元素的基本知识点。

直接上代码:

<html>
<head><title>TEST FORM</title></head>
<body>

<!--action的值是提交到哪个页面(url)-->

<!--method方法指定提交数据的方式,常用两种方式是get /post-->

<form action="#" method="post">
用户名:<input type="text" name="username" size="20"/><br/>
密  码:<input type="password" name="password" size="20"/><br/>
你的主页地址:<input type="text" name="website" value="http://" /><br/>
<p>设置size和maxlength的值</p>
<input type="text" name="name01" size="40" /><br/>
<input type="text" name="name02" maxlength="5" /><br/>
<hr />
<p>复选框和单选框</p>
<input type="checkbox" name="banana">banana<br/>
<input type="checkbox" name="apple">apple<br/>
<input type="checkbox" name="orange">orange<p>
<!--注意:单选框中的name属性要一样,才有显示效果-->
<input type="radio" name="fruit">banana<br/>
<input type="radio" name="fruit" checked>apple<br/>
<input type="radio" name="fruit">orange<br/>
<p>图像坐标</p>
<input type="image" name="face" src="f.png" /><p>
<input type=radio name=zoom value=2 checked>x2
<input type=radio name=zoom value=4>x4
<input type=radio name=zoom value=6>x6<p>
<p>隐藏表单</p>
<input type="hidden" name="hiddenform"> Here is a hidden element.<p>
<p>列表框</p>
<!--select属性:size, multiple(多选--注意,是用 Ctrl 键配合鼠标实现多选)-->
<select name="fruits" size="3" multiple>
<option>banana
<option selected>apple
<option value="my_favorite"/> orange
<option>peach
</select><p>
<p>文本区域</p>
<textarea name="comment" rows="5" cols="60">
</textarea><p>
<input type="submit" value="登录">
<input type="reset" value="重新填写">
</form>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: