1、最简单的表单
<!DOCTYPE html>
<html>
<head>
<title>biaodan1.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--普通文本-->
</head>
<body>
<form action="">
username:<input type="text" name="username"><br>
password:<input type="text" name="password">
</form>
<p><b>注意:</b>表单本身是不可见。并且注意一个文本字段的默认宽度是20个字符。</p>
</body>
</html>
2、表单提交账号密码,密码不可见
<!DOCTYPE html>
<html>
<head>
<title>biaodan1.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--普通文本-->
</head>
<body>
<form action="">
username:<input type="text" name="username"><br>
password:<input type="password" name="password">
</form>
<p><b>注意:</b>表单本身是不可见。并且注意一个文本字段的默认宽度是20个字符。</p>
</body>
</html>
3、单选框
<!DOCTYPE html>
<html>
<head>
<title>biaodan1.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--单选框-->
</head>
<body>
<form action="">
<input type="radio" name="sex" value="male">Male<br>
<input type="radio" name="sex" value="female">Female
</form>
<p><b>注意:</b>当用户点击一个单选按钮时,它就会被选中,其他同名的单选按钮就不会被选中。</p>
</body>
</html>
4、多选框
<!DOCTYPE html>
<html>
<head>
<title>biaodan1.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--多选框-->
</head>
<body>
<form action="">
<input type="checkbox" name="vehicle" value="bike">I have a bike<br>
<input type="checkbox" name="vehicle" value="Car">I have a car
</form>
<p><b>注意:</b>可以多选</p>
</body>
</html>
5、下拉框
<!DOCTYPE html>
<html>
<head>
<title>biaodan1.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--下拉框-->
</head>
<body>
<form action="">
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
</form>
</body>
</html>
6、下拉预选框
<!DOCTYPE html>
<html>
<head>
<title>biaodan1.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--下拉框,预选框-->
</head>
<body>
<form action="">
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat" selected>Fiat</option>
<option value="audi">Audi</option>
</select>
</form>
</body>
</html>
7、文本框
<!DOCTYPE html>
<html>
<head>
<title>biaodan1.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--文本域-->
</head>
<body>
<textarea rows="10" cols="30">
我是一个输入文本框
</textarea>
</body>
</html>
8、按钮
<!DOCTYPE html>
<html>
<head>
<title>biaodan1.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--按钮-->
</head>
<body>
<form action="">
<input type="button" value="Hello world">
</form>
</body>
</html>
9、带边框的表单
<!DOCTYPE html>
<html>
<head>
<title>biaodan1.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--带边框的表单-->
</head>
<body>
<form action="">
<fieldset>
<legend>Personal information:</legend>
Name:<input type="text" size="30"><br>
E-mail:<input type="text" size="30"><br>
Date of brith:<input type="text" size="10">
</fieldset>
</form>
</body>
</html>
10、待提交的表单
<!DOCTYPE html>
<html>
<head>
<title>biaodan1.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--带边框的表单-->
</head>
<body>
<form action="www.baidu.com">
First name: <input type="text" name="FirstName" value="Mickey"><br>
Last name: <input type="text" name="LastName" value="Mouse"><br>
<input type="submit" value="提交">
</form>
<p>点击"提交"按钮,表单数据将被发送到服务器上的www.baidu.com</p>
</body>
</html>