<input type=checkbox name=ch onclick="c_All(this)">全选<input type=checkbox name=a value="1">
<input type=checkbox name=a value="2">
<input type=checkbox name=a value="3">
<input type=checkbox name=a value="4">
<input type=checkbox name=a value="5">
<input type=checkbox name=a value="6">
<script>
function c_All(o){
var c=document.getElementsByName("a")
for(i=0;i<c.length;i++)c[i].checked=o.checked
}
</script>
<input type=checkbox name=a value="2">
<input type=checkbox name=a value="3">
<input type=checkbox name=a value="4">
<input type=checkbox name=a value="5">
<input type=checkbox name=a value="6">
<script>
function c_All(o){
var c=document.getElementsByName("a")
for(i=0;i<c.length;i++)c[i].checked=o.checked
}
</script>
为
b
c
d
e
f
怎么做到呢?
<form name=abc>
<input type=checkbox name=a value="1">
<input type=checkbox name=b value="2">
<input type=checkbox name=c value="3">
<input type=checkbox name=d value="4">
<input type=checkbox name=e value="5">
<input type=checkbox name=f value="6">
</form>
<script>
function c_All(o){
//var c=document.getElementsByName("a")
var c=abc.all;
for(i=0;i<c.length;i++)
{
if(c[i].type=='checkbox')
c[i].checked=o.checked
}
}
</script>
<input type=checkbox name=b value="2">
<input type=checkbox name=c value="3">
<input type=checkbox name=d value="4">
<input type=checkbox name=e value="5">
<input type=checkbox name=f value="6">
<script>
function c_All(o){
var c=document.getElementsByTagName("input")
for(i=0;i<c.length;i++){
if(c[i].type="checkbox")
c[i].checked=o.checked
}
}
</script>