function check(){
var count=0;
var obj=document.getElementsByName(checkbox1);
for(var i=0,i<obj.length;i++){
if(obj[i].checked=="true")
count+=1;
}
alert("你选中的行数:"+count);
}<input type="checkbox" name="checkbox1" id="checkbox1">
<input type="checkbox" name="checkbox1" id="checkbox2">
<input type="checkbox" name="checkbox1" id="checkbox3">
<input type="checkbox" name="checkbox1" id="checkbox4">
<input type="checkbox" name="checkbox1" id="checkbox5">
<input type="checkbox" name="checkbox2" id="checkbox21" onclick="check()">//第二行
是这个意思么?