JS大圣之路笔记——JS 前端判断checkbox是否选中,没有选中提示

 1  
 2 
 1 //判断页面中的checkbox是否选中,没有选中提示
 2  function CheckSelected(chkObject) {
 3 
 4          var checkArray = document.getElementsByTagName("input"); 
 5             var count = 0;
 6             for (j = 0; j < checkArray.length; j++) {
 7                 if (checkArray[j].type == "checkbox") {
 8                     if (  checkArray[j].checked==true)
 9                         count++;
10                 }
11             }
12             if (count>0) {
13                 Remove()
14             } else {
15             alert("请选中至少一条需要删除的数据!");
16             }
17         }
18  



原文地址:https://www.cnblogs.com/allenzhang/p/6122306.html