点击文字选中checkbox

查看实例:

<html>
<head>
<title>test</title>
<meta http-equiv="content-Type" content="text/html;charset=gb2312">
</head>
<body>
<form>

第一种:
文字必须是label标签内,checkbox的id和<label>标签内的for=""中的名字必须相同.
<label for="check1">姓名</label>
<input type="checkbox" id="check1" value="123" name="name">
<label for="check2">密码</label>
<input type="checkbox" id="check2" value="456" name="name">

第二种:
把文字和checkbox包含在<label>标签内
<label>测试<input type="checkbox" id="11" /></label>
</form>
</body>
</html>


Guess you like

Origin blog.csdn.net/kalision/article/details/49071363