<script language='javascript'>
function checkAll()
{
var obj = document.getElementById('divAll');
for(var i=0;i<obj.childNodes.length;i++)
{
var sObj = obj.childNodes[i];
if(sObj.type=="checkbox")
{
obj.childNodes[i].checked = true;
}
}
}</script>
<div id='divAll'>
<input type='checkbox' name='c[]' value='222'/>
<input type='checkbox' name='c[]' value='333'/>
<input type='checkbox' name='c[]' value='444'/>
<input type='checkbox' name='c[]' value='555'/>
<input type='checkbox' name='c[]' value='666'/>
</div><input type='radio' name='r' id='r' value='2' onclick='checkAll();'/>
var aa = document.getElementsByTagName("input");
for(var i=0; i<aa.length; i++){
if(aa[i].type=="checkbox")
aa[i].checked=true;
}
}<input type="radio" name="chkAll" onClick="this.checked?selectall():''" />
<input type="checkbox" name="ids" value="1" align="absmiddle">
<input type="checkbox" name="ids" value="2" align="absmiddle">
function checkAll()
{
var obj = document.getElementsByName('c[]');
for(var i=0;i<obj.length;i++)
{
var sObj = obj.[i];
if(sObj.type=="checkbox")
{
sObj.checked = true;
}
}
}</script>
<div id='divAll'>
<input type='checkbox' name='c[]' value='222'/>
<input type='checkbox' name='c[]' value='333'/>
<input type='checkbox' name='c[]' value='444'/>
<input type='checkbox' name='c[]' value='555'/>
<input type='checkbox' name='c[]' value='666'/> </div>
<input type='radio' name='r' id='r' value='2' onclick='checkAll();'/>
呵呵,以前总结的可能有的写法.