如何实现此功能
如何实现此功能
<script language="javascript">
function checkall(form)
{
for (var i = 0;i<form.elements.length;i++)
{
var e = form.elements[i];
e.checked = "checked" ;
}
}
</script>
<form id="form1" name="form1" method="post" action="untitled.asp">
<label>
<input name="che" type="checkbox" id="che" value="checkbox" />
a
</label>
<label>
<input name="che" type="checkbox" id="che" value="checkbox" />
</label>
<label>
b
<input name="che" type="checkbox" id="che" value="checkbox" />
</label>
<label>
c </label>
<label>
<input type="button" name="Submit" value="全选" onclick="checkall(this.form)" />
</label>
</form>
[CODE]<script language="javascript">
function SelAll_Click()
{
for(var i=0;i<this.chk.length;i++)
{
if(this.SelAll.checked)
this.chk[i].checked=true;
else
this.chk[i].checked=false;
}
}
</script>
<input type="checkbox" name="chk" value="">a<br>
<input type="checkbox" name="chk" value="">b<br>
<input type="checkbox" name="chk" value="">c<br>
<input type="checkbox" name="chk" value="">d<br>
<input type="checkbox" name="chk" value="">e<br>
<input type="checkbox" name="chk" value="">f<br>
<input type="checkbox" name="SelAll" onClick="SelAll_Click();">全选[/CODE]