复选框(Checkbox)
在一个表单里的所有多选框可以有一个或多个被选中。
<input type=checkbox>
<input type=checkbox checked>
单选框(RadioButton)
一个表单里的所有变量名相同的单选框只能够有一个被选中。
<input type=radio name=sex value=**>
<input type=radio name=sex value=** checked>
各个选项的name必须一样才能达到预期效果
基本语法
<select name=*> <option selected>说明</option>
<option value=**>说明2 </option>
</select>
(2)列表框的长度
<select size=**>
(3)允许多选
<select size=** multiple>
在一个表单里的所有多选框可以有一个或多个被选中。
<input type=checkbox>
<input type=checkbox checked>
<input type=checkbox value=**>
<html>
<head>
<title>复选框</title>
</head>
<body>
请选择您喜欢的音乐:<br>
<form>
<input type = "checkbox">摇滚<br><br>
<input type = "checkbox">爵士<br><br>
<input type = "checkbox">流行<br><br>
</form>
</body>
</html>
单选框(RadioButton)
一个表单里的所有变量名相同的单选框只能够有一个被选中。
<input type=radio name=sex value=**>
<input type=radio name=sex value=** checked>
各个选项的name必须一样才能达到预期效果
<html>
<head>
<title>单选框</title>
</head>
<body>
请选择您喜欢的音乐(只能选一种)
<form>
<input type = radio name = sex>摇滚<p>
<input type = radio name = sex>爵士<p>
<input type = radio name = sex>流行<P>
</form>
</body>
</html>
7.下拉列表
基本语法
<select name=*> <option selected>说明</option>
<option value=**>说明2 </option>
</select>
<html>
<head>
<title>列表框选择</title>
</head>
<body>
<select name = music>
<option value = 1>摇滚
<option value = 2 selected>爵士
<option value = 3>流行
</select>
<p>
<input type = submit value = "提交">
<input type = "reset" value = "重设">
</body>
</head>
</html>
7.下拉列表
(2)列表框的长度
<select size=**>
(3)允许多选
<select size=** multiple>
<html>
<head>
<title>列表框的长度</title>
</head>
<body>
<select size = 8 name = music>
<option value = 1>爵士
<option value = 2>流行
<option value = 3 selected>摇滚
<option value = 4>民乐
<option value = 5>儿歌
</select>
</body>
</html>
<html>
<head>
<title>列表框多选</title>
</head>
<body>
<select size = 8 name = music multiple>
<option>流行
<option>摇滚
<option>爵士
<option>民乐
</select>
<p>
<input type = "submit" name = submit value = "提交">
</body>
</html>