在网页设计时,可以使用单选框和复选框让用户进行选择。

语法:
1、type:
当 type="radio" 时,控件为单选框
当 type="checkbox" 时,控件为复选框
2、value:提交数据到服务器的值(后台程序PHP使用)
3、name:为控件命名,以备后台程序 ASP、PHP 使用
4、checked:当设置 checked="checked" 时,该选项被默认选中

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>单选框、复选框</title>
</head>
<body>
<form action="save.php" method="post" >
    <label>性别:</label>
    <label>男</label>
    <input type="checkbox" value="1"  name="gender" />
    <label>女</label>
    <input type="checkbox" value="2"  name="gender" />
</form>
</body>
</html>
最后修改:2019 年 09 月 18 日
您的支持就是我持续更新的动力!