淘宝京东购物车价格计算,商品店铺联动js

原生js实现京东淘宝购物车的做法 有好久没有写博客了,后面还是发现多写总结,才会有成长的快一些 好了,直接进入主题,话不多说,来看看购物车常用的功能,如图下。 图中的购物车,也是我们PC端常用到的一种,它主要包含了,“商品列表” 商品列中有包括了以下功能: 无疑就是这些很熟悉的业务了。下面来看看这些功能是怎么实现的。 选中多个商品、 计算商品总价、计算商品数量 商品数量加减操作、 删除商品 提交订单 ... 阅读详情
{% extends 'mobile/include/common_page_template.html' %}
{% load xiaozhuang_console_tag %}


{% block title %}
    购物车
{% endblock %}

{% block body %}
    <div class="works-head" style="background: #fbbc50">
        <a class="iconBack icon iconfont_list" href="javascript: history.go(-1);">&#xe693;</a>
        <h1 style="font-size: 16px;font-weight: normal;">购物车</h1>
        <p class="car_product_modify" id="modify">编辑</p>
    </div>

    <div class="product_car_contaier">

        {% for provider in provider_list %}
            <div class="product_parent">
                <div class="product_car_headInfo">
                    <p class="productCar_info"><span><i
                            class="iconfont_car car_select car_store">&#xe62e;</i></span><span><i
                            class="iconfont_car">&#xe607;</i></span><span>{{ provider.provider_user.name }}</span><span> > </span>
                    </p>
                </div>

                {% for cart_item in provider.cart_item_list %}
                    <div class="car_product_detail">
                        <p class="flex-center"><span><i class="iconfont_car car_select deleteTag">&#xe62e;</i></span>
                        </p>
                        <p class="car_product_img"><img src="/static/mobile/images/psds40528.jpg" alt=""></p>
                        <div class="car_product_description">
                            <p> {{ cart_item.product.name }}</p>
                            <p class='car_product_main'>主材套餐</p>
                            <p class="product_car_meal">月销12 笔 </p>
                            <p class="car_product_detail_price">{{ cart_item.product.price }}</p>
                            {#                store init value#}
                            <input type="hidden" value={{ cart_item.product.price }} class="product_car_initValue">
                            <input type="hidden" value={{ cart_item.product.id }} class="product_id_initValue">
                            <div class="gw_num">
                                <em class="jian">-</em>
                                <input type="text" value="1" class="num"/>
                                <em class="add">+</em>
                            </div>
                        </div>
                    </div>
                {% endfor %}
            </div>
        {% endfor %}

        {#------------footer------------#}
        <ul class="car_product_pay flex">
            <li><i class="iconfont_car " id="all_select">&#xe62e;</i></li>
            <li>
                <span>全选</span>
                <div class="product_car_price" id="product_price_show">
                    <p class="car_product_payInfo" id="product_totalPrice">合计:¥ <span>22000</span></p>
                    <p style="height: 20px;">不含运费</p>
                </div>
            </li>
            <li><span id="car_calculate">
                <a href="{% url 'mobile_customer_corder_create' %}">
                    结算
                </a>
            </span><span id="total_num">(0)</span></li>
        </ul>

        <div style="height: 80px;"></div>

        {#--------------------------ProductCar.js-------------------------------#}
        <script type="text/javascript">
            //核心理念 :!important 点击更换样式,改变自定义属性的值(价格通过自定义属性计算)
            /**
             * init js
             * author ly
             * @type {*|jQuery|HTMLElement}
             */
            var mTotal_money = 0;
            updatePrice(mTotal_money);
            //all select
            var all_select = $('#all_select');

            $(document).ready(function () {
                CarJsInit();
            });

            /**
             * init value
             * first step  : calculate the total money  foreach price
             * author ly
             * @type {*|jQuery|HTMLElement}
             */
            function CarJsInit() {
                all_select.attr('select', 'one');
                selectAll();
            }

            /**
             * all_select button event
             * author ly
             * @type {*|jQuery|HTMLElement}
             */
            function selectAll() {
                if (all_select.attr('select') == 'one') {
                    all_select.html('&#xe658;').css('color', '#f24f00');
                    $('.car_select').html('&#xe658;').css('color', '#f24f00');
                    all_select.attr('select', 'two');
                    $('.car_select').attr('clickNum', 'two');
                    calculate();
                } else if (all_select.attr('select') == 'two') {
                    updatePrice(0);
                    $('#total_num').html("(" + 0 + ")");
                    all_select.attr('select', 'one');
                    all_select.html('&#xe62e;').css('color', '#9f9f9d');
                    $('.car_select').html('&#xe62e;').css('color', '#9f9f9d');
                    $('.car_select').attr('clickNum', 'one');
                }
            }

            $('#all_select').click(function () {
                selectAll();
            });

            /**
             * Click change event
             * author ly
             * @type {*|jQuery|HTMLElement}
             */
            var select = $('.car_select');
            select.attr('clickNum', 'one');
            var num = 0;
            select.click(function () {
                var num = $(this).attr('clickNum');
                if (num == 'one') {
                    var select_num = 0;
                    $(this).attr('clickNum', 'two');
                    calculate();
                    $(this).html('&#xe658;').css('color', '#f24f00');
                } else {
                    $(this).attr('clickNum', 'one');
                    calculate();
                    $(this).html('&#xe62e;').css('color', '#9f9f9d');
                }
                var shop_select = $(this).parents('.car_product_detail').siblings('.product_car_headInfo').find('.car_select');
                //  var brother = $(this).parents('.car_product_detail').siblings('.car_product_detail');
                var brother = $(this).parents('.product_parent').find('.car_product_detail');
                for (var i = 0; i < brother.length; i++) {
                    if (brother.eq(i).find('.car_select').attr('clicknum') == 'one') {
                        //return 表示这个方法结束
                        //有一个未选中就表示,上边选中状态为未选中状态
                        shop_select.html('&#xe62e;').css('color', '#9f9f9d');
                        shop_select.attr('clicknum', 'one');
                        select_num++;
                        break;
                    }
                }
                if (select_num == 0) {
                    shop_select.html('&#xe658;').css('color', '#f24f00');
                    shop_select.attr('clicknum', 'two');
                }
            });

            /**
             * deal with delete click
             * author ly
             * @type {*|jQuery|HTMLElement}
             */
            $('#car_calculate').click(function () {
                var product = $('.car_product_detail');
                var price = $('.car_product_detail_price');
                var calHtml = $('#car_calculate').html()
                if (calHtml == '删除') {
                    //TODO: delete the element that you select
                    var car_select = $('.deleteTag');
                    for (var i = 0; i < car_select.length; i++) {
                        var count = 0;
                        if (car_select.eq(i).attr('clickNum') == 'two') {
                            car_select.eq(i).attr('statu', '001');
                            car_select.eq(i).attr('clickNum', 'one');
                            //todo: reduce money
                            mTotal_money -= parseInt(price.eq(i).html());
                            //update the money
                            updatePrice(mTotal_money);
                            var num = product.eq(i).siblings();
                            for (var j = 0; j < num.length; j++) {
                                if (num.eq(j).css('display') != 'none') {
                                    count++;
                                }
                            }
                            product.eq(i).hide();
                            if (count == 1) {
                                product.eq(i).parent().hide();
                            }
                        }
                    }
                } else if (calHtml == '结算') {
                    if (!isNull()) {
                        //todo : deal with calculate method
                        // save product_info into Car
                        saveProductInfo();
                        window.location.href = "{% url 'mobile_customer_corder_create' %}";
                    } else {
                        alert('购物车无需要结算商品');
                    }
                }
            });

            /**
             * modify click
             * author ly
             * @type {*|jQuery|HTMLElement}
             */
            $('#modify').click(function () {
                var modify = $('#modify').html();
                if (modify == '完成') {
                    $('#total_num').show();
                    $('#modify').html('编辑');
                    $('#car_calculate').html('结算');
                    $('#product_price_show').css('display', 'block');
                    $('.car_select').attr('clickNum', 'one');
                    $('#total_num').html("(" + 0 + ")");
                } else if (modify == '编辑') {
                    $('#total_num').hide();
                    $('#modify').html('完成');
                    $('#car_calculate').html('删除');
                    $('#product_price_show').css('display', 'none');
                    $('.car_select').attr('clickNum', 'one');
                    updatePrice(0);
                    $('#total_num').html("(" + 0 + ")");

                }
                $('.car_select').html('&#xe62e;').css('color', '#9f9f9d');
                //todo :
                $('#all_select').html('&#xe62e;').css('color', '#9f9f9d');
            });

            $(document).ready(function () {
                //add Product
                $(".add").click(function () {
                    var n = $(this).prev().val();
                    var num = parseInt(n) + 1;
                    if (num == 0) {
                        return;
                    }
                    $(this).prev().val(num);
                    //TODO:  calculate Money
                    //todo :  important  get the value when not in same father
                    var index = $('.add').index(this);
                    calculate();
                });
                //reduce Product
                $(".jian").click(function () {
                    var n = $(this).next().val();
                    var num = parseInt(n) - 1;
                    if (num == 0) {
                        return
                    }
                    $(this).next().val(num);
                    var index = $('.jian').index(this);
                    calculate();
                });
            })


            /**
             * despriction: calculate the money and update total price
             * author ly
             * @type {*|jQuery|HTMLElement}
             */
            function calculate() {
                mTotal_money = 0;//init
                var total_num = 0;
                var car_product_num = 0;// the num of product
                //todo : the calculate is wrong you can remember init value or add or -
                //TODO : CALCULATE MONEY NEED INIT VALUE!;
                var curr_money = $('.car_product_detail_price');
                var product_num = $('.num');
                for (var i = 0; i < curr_money.length; i++) {
                    var product_selecte = $('.car_product_detail_price').eq(i).parent().prev().prev().children(0).children(0);

                    if (product_selecte.attr('clickNum') == 'two' && product_selecte.attr('statu') != '001') {
                        var price = parseInt(product_num.eq(i).val()) * parseInt($('.product_car_initValue').eq(i).val());
                        mTotal_money += price;
                        updatePrice(mTotal_money);
                        car_product_num++;
                        total_num += parseInt(product_num.eq(i).val());
                    }

                    //表示没有一个是选中的,直接设置位0就好了
                    // 循环到最后 还是会走 0
                    if (car_product_num == 0) {
                        updatePrice(0);
                        $('#total_num').html("(" + 0 + ")");
                    }
                }

                $('#total_num').html("(" + total_num + ")");
            }

            /**
             * despriction: Shop and commodity linkage
             * ① 当选中上方标题时遍历  下边 商品节点 状态改为 选中状态
             ② 当全选中下方时,更改标题为选中状态
             ③ 当下方有一未选中时,更改更改标题为未选中状态
             ④ ---------> 变为选中状态 添加 class 之前 要先更改   自定义属性
             * author ly
             * @type {*|jQuery|HTMLElement}
             */
            $(document).ready(function () {
                $('.car_store').click(function () {
                    //这是点击之后 执行的  原本是 two 点击之后变成 One
                    var num = $(this).attr('clicknum');
                    if (num == 'one') {
                        $(this).parents('.product_car_headInfo').siblings().find('.car_select').html('&#xe62e;').css('color', '#9f9f9d');
                        $(this).parents('.product_car_headInfo').siblings().find('.car_select').attr('clicknum', 'one');
                    } else {
                        $(this).parents('.product_car_headInfo').siblings().find('.car_select').html('&#xe658;').css('color', '#f24f00');
                        $(this).parents('.product_car_headInfo').siblings().find('.car_select').attr('clicknum', 'two');
                    }

                    calculate();
                });
            });


            // update Price function
            function updatePrice(price) {
                if (price >= 0)
                    $('#product_totalPrice').html('合计' + price);
                else
                    $('#product_totalPrice').html('合计' + price);
            }

            /**
             * despriction: cookie init and Exposed interface
             * author ly
             * @type {*|jQuery|HTMLElement}
             */
            //TODO: 点击去结算的时候 当购物车为空的时候 告诉用户 购物车是空的
            var cookieJson = [];
            function saveProductInfo() {
                //  total price  price num  id
                var car_select = $('.deleteTag');
                var cookieJsonStr = '';
                for (var i = 0; i < car_select.length; i++) {
                    if (car_select.eq(i).attr('clickNum') == 'two') {


                        // var currPrice = $('.car_product_detail_price').eq(i).html();
                        var num = $('.num').eq(i).val();
                        var proId = $('.product_id_initValue').eq(i).val();
                        if (i != car_select.length - 1) {
                            cookieJsonStr += '[' + proId + ',' + num + ',' + 1 + '],';
                        } else {
                            cookieJsonStr += '[' + proId + ',' + num + ',' + 1 + ']';
                        }
                    }
                }

                var cookieJson = '[' + cookieJsonStr + ']';
                setCookie('cart_info', cookieJson, "d30");
                var xiaozhuangCart = new XiaozhuangCart();
//--------------------------------------------------------------------------------------------------------------------------------
                // ajax get to get total price
                $.get("http://127.0.0.1:8000/mobile/mall/cart/price", function (data, status) {
                    alert("Data: " + data.total_price + "\nStatus: " + status);
                    // update price
                    //updatePrice(data.total_price);
                });

                //     setCookie('cart_info', window.JSON.stringify(cookieJson), "d30");
            }

            /**
             * despriction: Judge whether the shopping cart is empty
             * author ly
             * @type {*|jQuery|HTMLElement}
             */
            function isNull() {
                var car_product_num = 0;
                var curr_money = $('.car_product_detail_price');
                var product_num = $('.num');
                for (var i = 0; i < curr_money.length; i++) {
                    var product_selecte = $('.car_product_detail_price').eq(i).parent().prev().prev().children(0).children(0);
                    if (product_selecte.attr('clickNum') == 'two' && product_selecte.attr('statu') != '001') {
                        car_product_num++;
                    }
                    if (car_product_num == 0) {
                        return 1;
                    }

                    return 0;
                }
            }

            //cookie 测试函数,使用cookie 存储json 数据,获取json 数据的值
            $(function () {
                saveProductInfo();
                var cookieJson = getCookie("car_Info");
                var cooieJsonVar = JSON.parse(cookieJson);
            });


            //cookie 封装 获取 cookie
            function getCookie(name) {
                var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
                if (arr = document.cookie.match(reg))
                    return unescape(arr[2]);
                else
                    return null;
            }

            //删除cookie
            function delCookie(name) {
                var exp = new Date();
                exp.setTime(exp.getTime() - 1);
                var cval = getCookie(name);
                if (cval != null)
                    document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
            }


            //设置cookie 以及过期时间
            function setCookie(name, value, time) {
                var strsec = getsec(time);
                var exp = new Date();
                exp.setTime(exp.getTime() + strsec * 1);
                document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
            }

            //获取设置过期时间
            function getsec(str) {
                var str1 = str.substring(1, str.length) * 1;
                var str2 = str.substring(0, 1);
                if (str2 == "s") {
                    return str1 * 1000;
                }
                else if (str2 == "h") {
                    return str1 * 60 * 60 * 1000;
                }
                else if (str2 == "d") {
                    return str1 * 24 * 60 * 60 * 1000;
                }
            }


            // Xiaozhuang cart management.
            function XiaozhuangCart() {
                // Load initial cart info from cookie.
                this.cart_item_map = {};
                try {
                    var cart_info_string = $.cookie('cart_info');
                    if (typeof(cart_info_string) == 'undefined') {
                        cart_info_string = '[]';
                    }
                    console.log('The cart info string is:' + cart_info_string);
                    for (var pid_and_num in window.JSON.parse(cart_info_string)) {
                        this.cart_item_map[pid_and_num[0]] = pid_and_num[1];
                    }
                } catch (e) {
                    console.log("Get cart info from cookie failed: " + e);
                }
                this.cart_item_map = {
                    2: 10,
                };
            }
            ;
            XiaozhuangCart.prototype.addProductToCart = function (pid, num) {
                this.cart_item_map[pid] = num;
                return this;
            };
            XiaozhuangCart.prototype.removeProductFromCart = function (pid) {
                delete this.cart_item_map[pid];
                return this;
            };
            XiaozhuangCart.prototype.saveToLocal = function () {
                var cart_item_list = [];
                for (var pid in this.cart_item_map) {
                    cart_item_list.push([pid, this.cart_item_map[pid]]);
                }
                // Save the object to cookie.
                $.cookie('cart_info', window.JSON.stringify(cart_item_list), {expires: 30});
                console.log("Save cookie to local: " + $.cookie('cart_info'));
                return this;
            };



        </script>
    </div>
{% endblock %}
JavaScript实现京东购物车页基础面效果 JavaScript实现京东购物车页基础面效果 HTML文件 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <!--引入样式--> <link rel="stylesheet" type="text/css" href="css/reset.css"/> <link rel="st 阅读详情

相关推荐

js实现购物车,原理简单,代码解释-->详细

大家在淘宝或者京东购物时,看到在选中全选按钮,或者其他商品选中,从而触发全选按钮是怎么实现的吗? 单商品的价格计算随着数量的增多减少而上升或者下降吗? 总价随着每个商品的价格相加或相减,而变化吗? 来看看下面的代码吧,实现以上所有功能。 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> </head> <bo

hnspystqxskzlqc的博客 9323

js实现运费的计算

一、题目: 编写代码:运输公司对用户计算运费.路程越远每公里运费越低。 每公里每吨货物的基本运费为10,货物重为w,距离为s,折扣为d, 则总运费f的计算公式为:f=10ws*(1-d) s<250km 没有折扣 250<=s<500 2%折扣 500<=s<1000 5%折扣 1000<=s<2000 8%折扣 2000<=s<3000 10%折扣 3000<=s 15%折扣 二、解题思路: 1.

qq_43435403的博客 2007

Spring Boot+Uniapp商城开发实战:多端适配与上架全流程解析

多端应用开发中,Uniapp以其一套代码覆盖App、小程序、H5的特性,成为电商项目快速落地的热门选择。而流媒体播放作为商品展示与直播场景的关键能力,常涉及HLS与RTSP协议的适配问题——比如vue播放m3u8需要依赖hls.js,uniapp实现rtsp视频播放则需借助流媒体网关转码。同时,移动端交互细节如uniapp安卓手势返回导致的闪退、keep-alive切换后列表滚动位置丢失、自定义分享好友及H5预览PDF等,都是高频踩坑点。这些技术难点的背后,是组件层级原理、页面生命周期管理与状态同步机制的综

weixin_27015733的博客 370

购物车计算总结(分功能)(如侵权就删)

这是一个简单的购物车实现,HTML代码中包括两个购物项(商品A和商品B),每个购物项包括商品名称、价格、数量,以及增加和减少按钮。 在JavaScript代码中,使用了两个循环分别为增加和减少按钮添加了点击事件处理函数。在增加按钮点击事件处理函数中,获取了当前购物项的元素,然后使用querySelector方法获取了商品价格元素和数量元素的引用,分别获取它们的值后,将数量加1并更新到数量元素,将商品价格累加到总价变量中,并将总价更新到相应元素上。在减少按钮点击事件处理函数中,通过类似的方式获取元素和值,判

IKUNzhenin的博客 355

jQuery模仿京东商城购物车

jQuery模仿京东商城购物车,可查看购物车商品,删除商品,登录等功能。

仿京东购物车页面

仿京东购物车页面仿京东购物车页面仿京东购物车页面仿京东购物车页面仿京东购物车页面仿京东购物车页面

制作京东购物车,包含html+js+css完整代码

商品布居html,同一店铺多个商品只需要复写class="item-item",更改内部的商品图片,名称,以及相对于的连接即可,不同店铺则复写class="cart-body"为所有的商品复选框添加点击事件,所有的商家name属性值保持一致,商品name属性值保持一致。制作京东购物车页面,实现全选商品,价格加减,商品数量加减,总价。JS函数,该函数包括获取商品总价,并显示总价及已选商品种类数量。点击全选,实现所有商品选中,并且算出总价,和已选择的商品数量。商品总价及已选择商品种类数量html部分。

m0_74937643的博客 3694

手把手教你用Synopsys AHB VIP搭建验证环境:从SINGLE到WRAP16的完整波形分析与避坑指南

本文详细介绍了如何使用Synopsys AHB VIP搭建验证环境,从基础配置到复杂波形调试实战。重点解析了AHB协议中各种Burst类型的地址计算机制,包括INCR和WRAP类型,并提供了实际案例和避坑指南,帮助工程师快速掌握验证技巧。

weixin_42552716的博客 416

校招编程题目(2) JavaScript:购物车操作(京东)

实现购物车的添加和删除功能

快去创造奇迹 828

华中科技大学 计算机组成原理 educoder Logisim平台 计算机数据表示实验

本文主要是对 计算机数据表示实验的笔记和相关Logisim平台的图,供大家学习交流使用。 需要源文件或者源代码,可以留言评论! 目录实验目的第1关:汉字国标码转区位码实验第2关:汉字机内码获取实验第3关:偶校验编码设计第4关:偶校验解码电路设计第5关:16位海明编码电路设计第6关:16位海明解码电路设计第7关:海明编码流水传输实验第8关:16位CRC并行编解码电路设计第9关:CRC编码流水传输实验实验结果: 实验目的 本实训将帮助同学们巩固对计算机中数据表示方法的理解,要求能设计汉字国标码与区位码之间的转换

weixin_48383580的博客 2万+

BU61580芯片实战:手把手教你配置1553B通信的BC端寄存器(含代码解析)

本文详细解析了BU61580芯片在1553B通信中的BC端寄存器配置方法,包括关键寄存器功能映射、初始化代码解析及回环测试实现。通过实战案例和代码示例,帮助开发者快速掌握1553B通信的核心技术,提升系统稳定性和通信质量。

a1b2c的博客 227

HTML5+CSS3+JavaScript 阶段性实践小案例——京东购物车

花了两三天时间将HTML4,HTML5,CSS2,CSS3大致学习了一下,现在来做一个网页实践一下,我是准备专攻后端开发的,所以前端只是浅尝辄止,定有不足,欢迎指正。 待更。。

长夜漫漫,无心睡眠 3931

AI智能体安全沙箱agentguard:为LLM代码执行筑起防火墙

在AI应用开发领域,大语言模型(LLM)驱动的智能体(Agent)能够自动生成并执行代码,极大地提升了自动化能力。然而,赋予AI直接执行系统命令的权限也带来了显著的安全风险,如恶意代码注入、敏感数据泄露和系统资源滥用。为了解决这一核心矛盾,安全沙箱技术应运而生,它通过在不可信代码与宿主系统之间建立隔离层,实现"默认拒绝、最小权限"的安全原则。agentguard项目正是这一理念的工程实践,它结合白名单机制与容器化隔离,为AI智能体提供了可配置、可审计的安全执行环境。该方案不仅适用于内部自动化工具开发,也为构

weixin_28695537的博客 298

springboot李庄古镇农产品销售系统 毕业设计----附源码66743

系统将用户、商家、管理员三种角色分为农产商品推荐、客服咨询、多级商城浏览、购物车和订单流转、地址簿维护、售后申请、店铺信息配置、商品上架下架、配送状态更新、可视化报表、用户权限审核等具体的业务。按照软件工程规范依次完成需求调研、总体架构设计、前后端功能模块划分、数据库关系建模、编码实现和测试验证。

VXSJ881的博客 170

基于Simulink的电机功率因数校正仿真

PF=SP​=视在功率有功功率​=cosϕ⋅Irms​I1​​(非正弦时)位移因数(cosϕ):基波电压电流相位差畸变因数(I1​/Irms​):谐波导致电流有效值增大本文带你完成了电机系统功率因数校正的Simulink仿真,实现了:✅ 理解了低功率因数的成因与危害✅ 搭建了无PFC、无源PFC、有源PFC三种对比模型✅ 掌握了Vienna整流器建模与dq解耦控制方法✅ 实现了PF与THD的自动计算与评估✅ 验证了有源PFC在PF、THD、稳定性上的全面优势。

amy_mhd的博客 154

使用 MATLAB/Simulink 构建一个基于FOC控制的PMSM矢量控制仿真模型

本教程详细介绍了基于MATLAB/Simulink的永磁同步电机(PMSM)磁场定向控制(FOC)系统建模与仿真方法。主要内容包括:PMSM电机模型参数设置、Clarke/Park变换模块设计、电流环PID控制器配置、SVPWM调制实现以及系统仿真参数优化。文章提供了模块化设计思路和具体参数设置示例,并给出了PID整定建议和进阶优化方向。通过该仿真模型,可深入理解PMSM矢量控制原理,掌握高性能电机控制系统的建模技巧,适用于伺服系统、电动汽车驱动等高端控制场景。教程还推荐了实时仿真和高级控制策略等扩展应用。

xiaoheshang_123的博客 530

原生js实现京东购物车

纯原生js实现京东购物车效果页面布局页面css页面效果js 完整代码 作为一名前端开发人员,购物的逻辑是经常遇到的, 尤其是商城类网站,订餐程序等,都需要购物车, 实际开发中购物车的逻辑相对简单,每一步操作都有后台数据作为支撑, 前端的主要的工作就是请求接口,渲染数据, 进行基础的逻辑判断处理; 但是在没有后台配合的情况下,纯粹的前端实现京东购物的完整逻辑,那就是有一定困难了 。。。 如果是一个前端小白,初学js的时候,一个头两个大, 在遇到购物车这样复杂的逻辑。头发都要掉光光了。。。 话不多说,直接给大

winterFlower1314的博客 4870

YOLO26改进策略【YOLO和Mamba】| 替换骨干 Mamba-YOLO26-L !!! 最新的发文热点

Vision Clue Merge模块在Mamba - YOLO模型中同样重要,主要负责在模型的下采样过程中处理特征图,为后续的特征融合和目标检测任务提供更有效的信息。

Limiiiing的博客 474

js 购物车数量增减,总价格联动变化

前端JS实现购物车功能,点击商品加减按钮商品数量加减,点击单选按钮和全选按钮颜色变化,总价联动变化。项目中应用的都是bootstrap的样式,css就不一一贴出来了。 加函数,减函数,手动修改数量判断库存函数,总价格计算函数,单选事件,全选事件,一共分为6个事件 原味手剥大瓜子

tangtang5963的博客 3万+

SAP 批量修改 工艺路线 和 BOM

1、在运维的过程中经常会遇到用户需要批量更改组件,或者是批量更改数量,还是组件里面的一些标识,当处理这些批量数据处理的业务时,BOM的批量更改一个想到的就是CS20,但是CS20当BOM需要替换的时候就不是很适用。当前工作区域:选择 SAP_ITEM 对BOM行项目进行变更,工艺路线也是可以批量更改的,根据实际的业务进行选择,我这里选择的就是BOM的组件变更。5、本博客将使用新的一种方式进行BOM的批量变更,标准的事务代码:CEWB对BOM进行批量更改。3、使用LSMW的方式进行BOM的批量更改。

我小时候很黑的博客 4100

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

HTML+CSS+JS仿京东购物车页面动态效果

目录 1 用到的知识 1.1 js选择器 1.2 循环语句 1.3 文档修改语句 1.4 模块移除属性 2 HTML代码 3 CSS代码 3.1 预处理css 3.2 jd购物车页面的css 4 jd购物车页面的js 5 效果展示 1 用到的知识 前面静态页面知识:HTML+CSS仿京东购物车页面静态页面 1.1 js选择器 var fav=document....

赵广陆 1万+

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

前端学习项目之—原生JS实现京东购物车(转载基础上实现删除功能)

原生js京东购物车,在转载基础上实现删除功能

sunpu316452857的博客 1181

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

京东购物车(html+css+js)

html+js部分 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>我的购物车</title> <link rel="stylesheet" type="text/css" href="css/css.css" /> <link rel="stylesheet" typ...

aa67567456的博客 1万+

京东购物车(动态)网页搭建,利用JavaScript实现

需要实现的功能: 单选操作、全选操作、单行删除操作、多行删除操作、价格结算 使用的方式 JavaScript 项目环境 win10+Hbuilder+chrome浏览器 项目结构 实现了所有功能的主界面 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>...

时间静止 5451

Html、Css、javaScript 网页制作之京东购物车

一.Html: 京东购物车.html: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" type="text/css" href="css/reset.css"/> <!--<link rel="stylesheet" type="text/css" href=

gdd1990shl的博客 5508

CSS3&JavaScript 仿京东加入购物车特效

&amp;amp;lt;!DOCTYPE html&amp;amp;gt; &amp;amp;lt;html&amp;amp;gt; &amp;amp;lt;head&amp;amp;gt; &amp;amp;lt;meta charset=&amp;quot;utf8&amp;quot;&amp;amp;gt; &amp;amp;lt;style&amp;amp;gt; body { marg

司马懿的西山居 3591
上一篇: decodeURIComponent() 函数可对 encodeURIComponent() 函数编码的 URI 进行解码。
下一篇: 解决jsCookie 页面跳转失效问题
一朵红杏
博客等级 码龄12年 51粉丝 282原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值