javascript全选

<script>
function SelectAll(objname,checkValue){
obj=document.getElementsByName(objname);
if(obj==null) return null;
for(i = 0; i <obj.length; i++){
obj[i].checked = checkValue;
}
}
</script>

HTML:
<table width="736" border="1" cellpadding="3" cellspacing="1" bordercolor="#d3d3d3" style="border-style:solid;border-collapse:collapse; text-align:center">
<tr><th width="2%"></th><th>岗</th><th width="10%">所</th><th align="center">应</th><th>招</th><th align="center">状</th><th width="10%" align="center">操</th><th align="center">浏</th></tr>
<tr>
<td><input name="id[]" type="checkbox" value="<!--$row['fId']-->"></td>
<tr>
<td colspan="8" id="do" style="text-align:left"><input type="checkbox" value="" title="全选" onClick="SelectAll('id[]',this.checked)">
</table>

你可能感兴趣的:(JavaScript,html)