您现在的位置是:主页 > Web前端技术 > Web前端技术

JavaScript如何实现购物车怎么开发技术

IDCBT2022-01-13服务器技术人已围观

简介这篇文章主要介绍了JavaScript如何实现购物车怎么,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。 具体内容

这篇文章主要介绍了JavaScript如何实现购物车怎么,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

具体内容如下

HTML结构

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/02-reset.css">
    <link rel="stylesheet" href="./css/style.css">
</head>
<body>
    <!-- 简单写个大盒子分大三栏 -->
    <div class="cart">
        <!-- 购物车头部 -->
        <div class="cart-head clearfix">
            <div class="col col-check u-l">
                <input type="checkbox" id="all" class="check">
                <label for="all">全选</label>
            </div>
            <div class="col col-img u-l">&nbsp;</div>
            <div class="col col-name u-l">商品名称</div>
            <div class="col col-price u-l">单价</div>
            <div class="col col-num u-l">数量</div>
            <div class="col col-sum u-l">小计</div>
            <div class="col col-action u-r">操作</div>
        </div>
        <!-- 购物车列表 -->
        <div class="cart-list">
            <!-- 商品块 -->
            <div class="list-item">
                <div class="item-box ">
                    <div class="col col-check u-l">
                        <input type="checkbox" class="check single">
                    </div>
                    <div class="col col-img u-l">
                        <img src="./images/1.jpg" alt="">
                    </div>
                    <div class="col col-name u-l">8848 移动版 4GB+64GB 千峰蓝</div>
                    <div class="col col-price u-l">8888元</div>
                    <div class="col col-num u-l ">
                        <div class="change-goods-num">
                            <a href="javascript:;" class="jianhao">-</a>
                            <input type="text" value="1">
                            <a href="javascript:;" class="jiahao">+</a>
                        </div>
                    </div>
                    <div class="col col-sum u-l">8888元</div>
                    <div class="col col-action u-r">删除</div>
                </div>
                <div class="item-box ">
                    <div class="col col-check u-l">
                        <input type="checkbox" class="check single">
                    </div>
                    <div class="col col-img u-l">
                        <img src="./images/1.jpg" alt="">
                    </div>
                    <div class="col col-name u-l">8848 移动版 4GB+64GB 千峰蓝</div>
                    <div class="col col-price u-l">8888元</div>
                    <div class="col col-num u-l ">
                        <div class="change-goods-num">
                            <a href="javascript:;" class="jianhao">-</a>
                            <input type="text " value="1">
                            <a href="javascript:;" class="jiahao">+</a>
                        </div>
                    </div>
                    <div class="col col-sum u-l">8888元</div>
                    <div class="col col-action u-r">删除</div>
                </div>
                <div class="item-box ">
                    <div class="col col-check u-l">
                        <input type="checkbox" class="check single">
                    </div>
                    <div class="col col-img u-l">
                        <img src="./images/1.jpg" alt="">
                    </div>
                    <div class="col col-name u-l">8848 移动版 4GB+64GB 千峰蓝</div>
                    <div class="col col-price u-l">8888元</div>
                    <div class="col col-num u-l ">
                        <div class="change-goods-num">
                            <a href="javascript:;" class="jianhao">-</a>
                            <input type="text" value="1">
                            <a href="javascript:;" class="jiahao">+</a>
                        </div>
                    </div>
                    <div class="col col-sum u-l">8888元</div>
                    <div class="col col-action u-r">删除</div>
                </div>
                <div class="item-box ">
                    <div class="col col-check u-l">
                        <input type="checkbox" class="check single">
                    </div>
                    <div class="col col-img u-l">
                        <img src="./images/1.jpg" alt="">
                    </div>
                    <div class="col col-name u-l">8848 移动版 4GB+64GB 千峰蓝</div>
                    <div class="col col-price u-l">8888元</div>
                    <div class="col col-num u-l ">
                        <div class="change-goods-num">
                            <a href="javascript:;" class="jianhao">-</a>
                            <input type="text" value="1">
                            <a href="javascript:;" class="jiahao">+</a>
                        </div>
                    </div>
                    <div class="col col-sum u-l">8888元</div>
                    <div class="col col-action u-r">删除</div>
                </div>
            </div>
        </div>
        <!-- 购物车底部 -->
        <div class="cart-foot">
            <div class="section-left u-l">
                <a href="">继续购物</a>
                <span>已选择 <i id="totalNum">0</i> 件商品</span>
            </div>
            <div class="u-r settlement">去结算</div>
            <div class="u-r total-price">合计: <em id="totalPrice">0</em>元</div>
        </div>
    </div>
 
    <script type="text/javascript" src="./js/script.js"></script>
</body>
</html>

标签:

很赞哦! ()

本栏推荐