这是一个例子:
注意事项:文字必须是label标签内,checkbox的id和<label>标签内的for=""中的名字必须相同.
<pre name="code" class="html"><html>
<head>
<title>复选框点击文字选中</title>
<meta http-equiv="content-Type" content="text/html;charset=gb2312">
</head>
<body>
<!--把下面代码加到<body>与</body>之间-->
<form>
<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">
</form>
</body>
</html>
加上Freemark标签后的应用:
<#list baseInfos as obj>
<input type="checkbox" id="platId${obj_index}" name="platId" value="${obj.platId}"/>
<label for="platId${obj_index}">${obj.platId}</label>
</#list>
注意事项:文字必须是label标签内,checkbox的id和<label>标签内的for=""中的名字必须相同.