jquery实现复选框多选、单选、全不选功能,很实用
[php]文章源自陈学虎-https://chenxuehu.com/article/2013/06/1184.html
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
function selectGroup(checkbox,obj) {
$('input[name='+obj+']').attr('checked', $(checkbox).attr('checked'));
}
</script>
</head>
<body>
<input type="checkbox" onclick="selectGroup(this,'grp1');" />选中GROUPA<br/>
GROUPA:<br/>
<input type="checkbox" name="grp1" />11<br/>
<input type="checkbox" name="grp1" />22<br/>
<input type="checkbox" name="grp1" />33<br/><br/>文章源自陈学虎-https://chenxuehu.com/article/2013/06/1184.html
<input type="checkbox" onclick="selectGroup(this,'grp2');" />选中GROUPB<br/>
GROUPB:<br/>
<input type="checkbox" name="grp2" />44<br/>
<input type="checkbox" name="grp2" />55<br/>
<input type="checkbox" name="grp2" />66<br/>
</body>
</html>文章源自陈学虎-https://chenxuehu.com/article/2013/06/1184.html
[/php]文章源自陈学虎-https://chenxuehu.com/article/2013/06/1184.html 文章源自陈学虎-https://chenxuehu.com/article/2013/06/1184.html
评论