<script language='javascript'>
<!--
function chkall()
{
var e=document.form_list.elements;
for (var i=0;i<e.length;i++)
{
if (e[i].name=="chkboxlist") e[i].checked=document.form_list.allbox.checked;
}
}
//-->
</script>
<form name="form_list" method="post" action="">
<INPUT name="chkboxlist" type=checkbox>
<INPUT name="chkboxlist" type=checkbox>
<INPUT name="chkboxlist" type=checkbox>
<INPUT name="chkboxlist" type=checkbox>
<INPUT name="chkboxlist" type=checkbox>
<INPUT name="chkboxlist" type=checkbox>
<p>
<input type="checkbox" name="allbox" value="Check All" onClick="chkall();">
</form>
<!--
function chkall()
{
var e=document.form_list.elements;
for (var i=0;i<e.length;i++)
{
if (e[i].name=="chkboxlist") e[i].checked=document.form_list.allbox.checked;
}
}
//-->
</script>
<form name="form_list" method="post" action="">
<INPUT name="chkboxlist" type=checkbox>
<INPUT name="chkboxlist" type=checkbox>
<INPUT name="chkboxlist" type=checkbox>
<INPUT name="chkboxlist" type=checkbox>
<INPUT name="chkboxlist" type=checkbox>
<INPUT name="chkboxlist" type=checkbox>
<p>
<input type="checkbox" name="allbox" value="Check All" onClick="chkall();">
</form>
靠
那个贴主tmd不是人,我都用了你给的程序了.tmd还不给分
{
element.checked==(element.checked==true)?false:true;
}
也许楼主不在网上呢,请六他观察几天再下结论吧!
<script>
function chkall(all){
for(i=0;i<form_list.chkboxlist.length;i++)
form_list.chkboxlist[i].checked=all;}
</script>
<form name="form_list" method="post" action="">
<INPUT name="chkboxlist" type=checkbox>信息1<br>
<INPUT name="chkboxlist" type=checkbox>信息2<br>
<INPUT name="chkboxlist" type=checkbox>信息3<br>
<INPUT name="chkboxlist" type=checkbox>信息4<br>
<INPUT name="chkboxlist" type=checkbox>信息5<br>
<INPUT name="chkboxlist" type=checkbox>信息6<br>
<p>
<input type="checkbox" name="allbox" value="Check All" onClick="chkall(this.checked);">全选
for(element in document.formname.checkboxname)是如何用呢?望指教!
{
element.checked==(element.checked==true)?false:true;
}
高手就是不同,厲害!!!
var tags=document.form_list.item("chkboxlist")
for(i=0;i<tags.length;i++)tags[i].checked=event.srcElement.checked;
tags.checked=event.srcElement.checked