直接看例子吧: shippingAddressList  为一个集合

<c:forEach items="${shippingAddressList }" var="var">

<tr>
<td align="right"><input type="checkbox" value="${var.id }" name="checked"> </td>
<td>${var.contact }</td>
<td>${var.phone}</td>
<td>${var.postalCode }</td>
<td align="left">${var.address }</td>
</tr>

</c:forEach>

//forEach循环遍历出所有的checkbox  他们具有相同的name

var i=0;

var items = document.getElementsByName("checked");          //这个语句帮我们筛选出一组name为checked的复选框。。

for(var j=0; j<items.length; j++){

if(items[j].checked){               //如果该复选框被选中

i++;                            //统计被选中的个数

}

}

判断checkbox选中的个数的更多相关文章

  1. 【jQuery获取下拉框select、单选框radio、input普通框的值和checkbox选中的个数】

    radio单选框:name属性相同 <input type="radio" id="sp_type" name="p_type" va ...

  2. JQuery判断checkbox选中,jquery获取选中的checkbox

    选中的radio $('input[name="radInvoiceType"]:checked').val(); 这样能获得 $('input[name="radInv ...

  3. 关于判断checkbox选中问题

    attr和prop的区别: 因为DOM节点属性可以理解为静态的,当页面渲染完,checked属性就确定了,就是checked.而HTML元素属性是动态的,随时可以改变,而且对于checked这个属性, ...

  4. Jquery判断checkbox选中状态

    jQuery v3.3.1 <input type="checkbox" id="ch"> 判断 $('#ch').is(':checked'); ...

  5. 判断checkbox选中

    源码如下,仅限参考,直接复制即可: <meta http-equiv="Content-Type" content="text/html; charset=utf- ...

  6. # li鼠标移入移出,点击,变背景色,变checkbox选中状态

    移入移出背景色改变和点击背景色改变,两者是否相互覆盖? 若移出背景色恢复,影响点击事件的背景色改变,会产生效果为: 点击时,背景色改变,并且checkbox选中 鼠标移开后,checkbox仍选中,但 ...

  7. checkbox选中的问题(Ajax.BeginForm)

    判断checkbox选中的方法方法一:if ($("#checkbox-id")get(0).checked) { // do something} 方法二:if($('#chec ...

  8. ----------jqery和js如何判断checkbox是否选中 --------两个单选按钮如何选一个,且用jquery获取被选的值

    jqery和js如何判断checkbox是否选中 jquery: <div id="divId" class="divTable"> <div ...

  9. jQuery通过判断 checkbox 元素的 checked 属性,判断 checkbox是否被选中

    jQuery设置复选框的属性<input type="checkbox"/> $("input").attr("checked" ...

随机推荐

  1. 2018-2019-20172329 《Java软件结构与数据结构》第五周学习总结

    2018-2019-20172329 <Java软件结构与数据结构>第五周学习总结 教材学习内容总结 <Java软件结构与数据结构>第九章-排序与查找 一.查找 1.查找概念简 ...

  2. BZOJ 3339: Rmq Problem 莫队算法

    3339: Rmq Problem 题目连接: http://www.lydsy.com/JudgeOnline/problem.php?id=3339 Description n个数,m次询问l,r ...

  3. Codeforces Round #272 (Div. 2) D. Dreamoon and Sets 构造

    D. Dreamoon and Sets 题目连接: http://www.codeforces.com/contest/476/problem/D Description Dreamoon like ...

  4. PHP常用设计模式

    1.单例模式指在整个应用中只有一个对象实例的设计模式 class Single { public $rand; static private $instance; // 类直接调用 final pri ...

  5. VGA Output from STM32F4 Discovery board

    VGA Output from STM32F4 Discovery board I love the web! There are so many cool projects out there, a ...

  6. systemtap跟踪C

    1.[root@localhost ~]# rpm -qi  glibcName        : glibc                        Relocations: (not rel ...

  7. 报错:System.NotSupportedException: LINQ to Entities does not recognize the method

    报错:System.NotSupportedException: LINQ to Entities does not recognize the method ...... get_Item(Int3 ...

  8. Delphi 实现对注册表的监视和扫描

    ;iRes := RegEnumKey( hKeyx, dwIndex, buf, dwSize );if iRes = ERROR_NO_MORE_ITEMS thenbreakelse if iR ...

  9. 一共81个,开源大数据处理工具汇总(下),包括日志收集系统/集群管理/RPC等

    作者:大数据女神-诺蓝(微信公号:dashujunvshen).本文是36大数据专稿,转载必须标明来源36大数据. 接上一部分:一共81个,开源大数据处理工具汇总(上),第二部分主要收集整理的内容主要 ...

  10. dev的documentManager,多个tab窗体

    private void AddDocument(Funcation CurrentModel) { if (!string.IsNullOrWhiteSpace(CurrentModel.Funct ...