1html
<thead>
<tr>
<th ><label><input type="checkbox" class="chooseAll" autocomplete="off">全选</label></th>
</tr>
</thead><pre name="code" class="html"><tbody>
<tr>
<th ><input type="checkbox" class="id choose" value="" autocomplete="off"></th>
</tr>
<pre name="code" class="html"><pre name="code" class="html"> <tr>
<th ><input type="checkbox" class="id choose" value="" autocomplete="off"></th>
</tr>
</tbody>
2全选/取消全选
<script>
function chooseAll(){
if($(this).is(':checked'))
{
$('.choose').prop("checked",true);
}
else
{
$('.choose').prop("checked",false);
}
}
function share(){
var ids=new Array;
$('.id:checked').each(function(){
var val=$(this).val();
ids.push(val);
});
if(ids.length > 0){
window.location.href='www.xx.com?ids='+ids.join('|');
}else{
layer.alert('请选择XXX');
}
}
$(function(){
$('.chooseAll').click(chooseAll);
$('.choose').click(function(){
if(!$(this).is(':checked'))
{
$('.chooseAll').prop("checked",false);
}
});
$('.share').click(share);
});
</script>