<script type="text/javascript">
$(function () {
$("#setAll").click(function () {
$(":checkbox[name=playList]").attr("checked", true);
});
$("#unSetAll").click(function () {
$(":checkbox[name=playList]").attr("checked", false);
});
$("#reverse").click(function () {
$(":checkbox[name=playList]").each(function () {
$(this).attr("checked", !$(this).attr("checked"));
});
});
});
</script>
<body>
<input type="checkbox" name="playList" />歌曲1<br />
<input type="checkbox" name="playList" />歌曲2<br />
<input type="checkbox" name="playList" />歌曲3<br />
<input type="checkbox" name="playList" />歌曲4<br />
<input type="checkbox" name="playList" />歌曲5<br />
<input type="checkbox" name="playList" />歌曲6<br />
<input type="button" id="setAll" value="全选"/>
<input type="button" id="unSetAll" value="全不选"/>
<input type="button" id="reverse" value="反选"/></body>
$(function () {
$("#setAll").click(function () {
$(":checkbox[name=playList]").attr("checked", true);
});
$("#unSetAll").click(function () {
$(":checkbox[name=playList]").attr("checked", false);
});
$("#reverse").click(function () {
$(":checkbox[name=playList]").each(function () {
$(this).attr("checked", !$(this).attr("checked"));
});
});
});
</script>
<body>
<input type="checkbox" name="playList" />歌曲1<br />
<input type="checkbox" name="playList" />歌曲2<br />
<input type="checkbox" name="playList" />歌曲3<br />
<input type="checkbox" name="playList" />歌曲4<br />
<input type="checkbox" name="playList" />歌曲5<br />
<input type="checkbox" name="playList" />歌曲6<br />
<input type="button" id="setAll" value="全选"/>
<input type="button" id="unSetAll" value="全不选"/>
<input type="button" id="reverse" value="反选"/></body>