日期:2014-05-17  浏览次数:20827 次

HTML零基础学习笔记(三)
表单的语法:
<form action ="表单提交地址" method ="提交方法" name ="MyForm">
<!--文本框、按钮等表单元素-->
</form>

method的值通常是:"get" 或 "post"

<!--表单元素的基本格式-->
<input name ="元素格式" type ="类型" value ="值" size ="显示宽度" maxlength ="字符长度" checked ="是否选中" />

type属性包括:
1、text:文本输入框
2、password:密码输入框
3、radio:单选按钮
4、checkbox:复选框
5、submit:提交按钮
6、reset:重置按钮
7、button:普通按钮
8、hidden:隐藏域
9、image:图像按钮
10、file:文本域


<!--文本输入框-->
<input type ="text" name ="username" size ="20" />
<!--密码输入框-->
<input type ="password" name ="pwd" size ="20" />
<!--单选框-->
<p>性别:
<input type ="radio" name ="sex" value ="女" />女
<input type ="radio" name ="sex" value ="男" checked ="checked"/>男
</p>
<!--复选框-->
<p>课程选择:
<input type ="checkbox" name ="cb1" value ="C++" />C++
<input type ="checkbox" name ="cb2" value ="java" />java
<input type ="checkbox" name ="cb3" value ="C#" />C#
<input type ="checkbox" name ="cb4" value ="php" />php
</p>
<!--提交按钮/重置按钮/普通按钮-->
<input type ="submit" name ="submit1" value ="提交" />
<input type ="reset" name ="reset1" value ="重置" />
<input type ="button" name ="button1" value ="取消" />
<!--下拉列表-->
<select name ="列表名称">
    <option value ="值">text</option>
</select>
<!--多行文本域 cols:文本区内的可见宽度  rows:文本区内的可见高度-->
<textarea name ="content" cols ="x" rows ="y">
   text
</textarea>