前端全选框
<input type=‘checkbox‘ name=‘allSelect‘ onclick=‘sel(this)‘></input> //有i个选择框 <input type=‘checkbox‘ name=‘isSelect‘ value=‘"+data[i].id+"‘ ></input>
js方法实现
<script type="text/javascript"> function sel(obj){ var a = document.getElementsByName(‘isSelect‘); //alert(document.getElementsByName(‘isSelect‘).length); for(var i = 0;i<a.length;i++){ a[i].checked = obj.checked; } } </script>
时间: 2024-10-05 03:09:43