function countNum(){
//alert($('input[name=check]:
checked').length);
var arrays = new Array();
var items = document.getElementsByName("check");
for(var i=0;i<items.length;i++){
if(items[i].checked){
arrays.push(items[i].value);
}
}
alert(arrays.length);
}
<input type="
checkbox" value="1" name="check" checked/>
<input type="checkbox" value="2" name="check"/>
<input type="checkbox" value="3" name="check"/>
<input type="button" value="选中个数" id="btn" onclick="countNum();">