标题:javaweb初学者一个小问题
取消只看楼主
wyh416
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2020-10-9
结帖率:33.33%
 问题点数:0 回复次数:0 
javaweb初学者一个小问题
<div class="item item2">
            <div class="sc">
                <table id="cb">
                    <tr class="t1">
                        <td style="width: 70px;"><input type="checkbox" name="" id="sca">全选</td>
                        <td style="width: 70px;"><input type="checkbox" name="" id="del">删除</td>
                        <td>商品图片</td>
                        <td>商品名</td>
                        <td style="width: 100px">商品价格</td>
                        <td>商品数量</td>
                        <td>总价</td>
                        <td style="width: 60px">结算</td>
                    </tr>

                    <c:forEach items="${cartItems}" var="cartItem">
                        <tr class="t2">
                            <td style="width: 60px;"><input type="checkbox" name="" id="bs"></td>
                            <td style="width: 60px;color: red"><a
                                    href="${sw}/DebateShopItemServlet?pid=${cartItem.pId}">删除</a></td>
                            <td><img src="${cartItem.shop.sPhoto}" alt=""></td>
                            <td style="color: blueviolet;">${cartItem.shop.sName}</td>
                            <td style="font-size: 16px">$${cartItem.price}</td>
                            <td style="position: relative">
                                <ul class="amount">
                                    <li style="float: left;"><a
                                            href="${sw}/DecrCartServlet?pid=${cartItem.pId}&uid=${cartItem.uId}">-</a>
                                    </li>
                                    <input type="text" value="${cartItem.amount}"
                                           style="width: 25px;height: 26px;float: left;text-align: center;border: none">
                                    <li style="float: left"><a
                                            href="${sw}/AddCartServlet?pid=${cartItem.pId}&uid=${cartItem.uId}">+</a>
                                    </li>
                                </ul>
                                <br>
                                <div style="margin-top: 35px;color: red;font-size: 13px"><c:if
                                        test="${cartItem.amount<2}">${ss}</c:if></div>
                            </td>
                            <td style="color: blue">总价:${cartItem.amount*cartItem.price}</td>
                            <td style="width: 60px">结算</td>
                        </tr>
                    </c:forEach>
                </table>


javaweb 制作了了一个商品购买网页购物车,在用户登录后,可以从数据库拿到该用户的所有购物车信息并且于页面中实现(已经实现)

现在的目的是通过点击全选旁边的这个复选框,使商品自己拥有的这个小复选框也勾选
    但是因为页面中的这些购物车信息,全是从数据库拿到数据后才在页面出现的(小的复选框也是在登陆后才显示的)
想通过Js拿到所有的小复选框,但是总是只能拿到第一个显示的购物车信息的复选框
???求问:因该怎样才能拿到所有的复选框?
搜索更多相关主题的帖子: 商品 复选框 pid style class 
2022-04-07 16:55



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-508801-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.063862 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved