<!DOCTYPE html><html><head><meta charset="utf-8" /><title></title><script type="text/javascript"> window.onload = function(){ var btn = document.getElementById("btn"); btn.onclick = function(){ var arrays = new Array(); var items = document.getElementsByTagName("check"); for(i=0; i<items.length; i++) { if(items[i].checked){ arrays.push(items[i].value); } } alert("选中的个数:"+arrays.length) } }</script></head><body><input type="checkbox" value="1" name="check" checked="checked" /><input type="checkbox" value="2" name="check" /><input type="checkbox" value="3" name="check" checked="checked" /><input type="button" value="你选中的个数" id="btn" /></body></html>
添加回答
举报
0/150
提交
取消