<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        jQuery實現(xiàn)購物車添加商品并結(jié)算

        來源:懂視網(wǎng) 責編:小采 時間:2020-11-27 19:53:00
        文檔

        jQuery實現(xiàn)購物車添加商品并結(jié)算

        jQuery實現(xiàn)購物車添加商品并結(jié)算:這次給大家?guī)韏Query實現(xiàn)購物車添加商品并結(jié)算,jQuery實現(xiàn)購物車添加商品并結(jié)算的注意事項有哪些,下面就是實戰(zhàn)案例,一起來看一下。<!DOCTYPE html> <html> <head> <metacharset="UTF-8"&
        推薦度:
        導(dǎo)讀jQuery實現(xiàn)購物車添加商品并結(jié)算:這次給大家?guī)韏Query實現(xiàn)購物車添加商品并結(jié)算,jQuery實現(xiàn)購物車添加商品并結(jié)算的注意事項有哪些,下面就是實戰(zhàn)案例,一起來看一下。<!DOCTYPE html> <html> <head> <metacharset="UTF-8"&

        這次給大家?guī)韏Query實現(xiàn)購物車添加商品并結(jié)算,jQuery實現(xiàn)購物車添加商品并結(jié)算的注意事項有哪些,下面就是實戰(zhàn)案例,一起來看一下。

        <!DOCTYPE html>
        <html>
         <head>
         <metacharset="UTF-8">
         <title></title>
         <scripttype="text/javascript"src="js/jquery-1.8.3.js"></script>
         <script>
         /*刪除*/
         $(function(){
         $(".blue").bind("click",function(){
         $(this).parent().parent().remove();
         totalPrice();
         });
         
         /*當鼠標離開文本框時,獲取當前值,調(diào)用totalPrice()函數(shù)進行結(jié)算*/
         $(".shopping_product_list_5 input").bind("blur",function(){
         var t = $(this).val();
         totalPrice();
         });
         var allPrice = 0;
         var allReduce = 0;
         var allCount = 0;
         
         $("#myTableProduct tr").each(function(){ /*循環(huán)購物車列表的每一行*/
         var num = parseInt($(this).find(".shopping_product_list_5 input").val()); /*獲取文本框中數(shù)量值*/
         var price = parseFloat($(this).find(".shopping_product_list_4 label").text()); /* 獲取商品價格*/
         var total = price * num;
         allPrice += total; /*計算所有商品的總價格*/
         
         /*獲取節(jié)省的金額*/
         var reduce = parseFloat($(this).find(".shopping_product_list_3 label").text()) - parseFloat($(this).find(".shopping_product_list_4 label").text());
         var reducePrice = reduce*num;
         allReduce +=reducePrice;
         
         /*獲取積分*/
         var count = parseFloat($(this).find(".shopping_product_list_2 label").text());
         allCount +=count;
         });
         $("#product_total").text(allPrice.toFixed(2)); /*填寫計算結(jié)果,其中利用toFixed()函數(shù)保留兩位小數(shù)*/
         $("#product_save").text(allReduce.toFixed(2));
         $("#product_integral").text(allCount.toFixed(2));
        });
         function totalPrice(){
         var allPrice = 0;
         var allReduce = 0;
         var allCount = 0;
         $("#myTableProduct tr").each(function(){
         var num = parseInt($(this).find(".shopping_product_list_5 input").val());
         var price = parseFloat($(this).find(".shopping_product_list_4 label").text());
         var total = price * num;
         allPrice += total;
         
         var reduce = parseFloat($(this).find(".shopping_product_list_3 label").text()) - parseFloat($(this).find(".shopping_product_list_4 label").text());
         var reducePrice = reduce*num;
         allReduce +=reducePrice;
         
         var count = parseFloat($(this).find(".shopping_product_list_2 label").text());
         allCount +=count;
         });
         $("#product_total").text(allPrice.toFixed(2));
         $("#product_save").text(allReduce.toFixed(2));
         $("#product_integral").text(allCount.toFixed(2));
         }
         </script>
         </head>
         <body>
         <pclass="shopping_list_top">您已選購以下商品</p>
         <pclass="shopping_list_border">
         <tablewidth="100%"border="1px solid #ccc">
         <trclass="shopping_list_title">
         <tdclass="shopping_list_title_1">商品名</td>
         <tdclass="shopping_list_title_2">單品積分</td>
         <tdclass="shopping_list_title_3">市場價</td>
         <tdclass="shopping_list_title_4">當當價</td>
         <tdclass="shopping_list_title_5">數(shù)量</td>
         <tdclass="shopping_list_title_6">刪除</td>
         </tr>
         </table>
         <tablewidth="100%"border="1px solid #ccc"id="myTableProduct">
         
         <trclass="shopping_product_list"id="shoppingProduct_01">
         <tdclass="shopping_product_list_1"><ahref="#"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"class="blue">私募(首部披露資本博弈秘密的金融...</a></td>
         <tdclass="shopping_product_list_2"><label>189</label></td>
         <tdclass="shopping_product_list_3">¥<label>32.00</label></td>
         <tdclass="shopping_product_list_4">¥<label>18.90 </label>(59折)</td>
         <tdclass="shopping_product_list_5"><inputtype="text"value="1"/></td>
         <tdclass="shopping_product_list_6"><ahref="javascript:void(0)"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"class="blue">刪除</a></td>
         </tr>
         <trclass="shopping_product_list"id="shoppingProduct_02">
         <tdclass="shopping_product_list_1"><ahref="#"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"class="blue"> 小團圓(張愛玲最神秘小說遺稿)</a></td>
         <tdclass="shopping_product_list_2"><label>173</label></td>
         <tdclass="shopping_product_list_3">¥<label>28.00</label></td>
         <tdclass="shopping_product_list_4">¥<label>17.30</label>(62折)</td>
         <tdclass="shopping_product_list_5"><inputtype="text"value="1"/></td>
         <tdclass="shopping_product_list_6"><ahref="javascript:void(0)"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"class="blue">刪除</a></td>
         </tr>
         <trclass="shopping_product_list"id="shoppingProduct_03">
         <tdclass="shopping_product_list_1"><ahref="#"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"class="blue">不抱怨的世界(暢銷全球80國的世界...</a></td>
         <tdclass="shopping_product_list_2"><label>154</label></td>
         <tdclass="shopping_product_list_3">¥<label>24.80</label></td>
         <tdclass="shopping_product_list_4">¥<label>15.40</label> (62折)</td>
         <tdclass="shopping_product_list_5"><inputtype="text"value="2"/></td>
         <tdclass="shopping_product_list_6"><ahref="javascript:void(0)"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"class="blue">刪除</a></td>
         </tr>
         <trclass="shopping_product_list"id="shoppingProduct_04">
         <tdclass="shopping_product_list_1"><ahref="#"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"class="blue">福瑪特雙桶洗衣機XPB20-07S</a></td>
         <tdclass="shopping_product_list_2"><label>358</label></td>
         <tdclass="shopping_product_list_3">¥<label>458.00</label></td>
         <tdclass="shopping_product_list_4">¥<label>358.00</label> (78折)</td>
         <tdclass="shopping_product_list_5"><inputtype="text"value="1"/></td>
         <tdclass="shopping_product_list_6"><ahref="javascript:void(0)"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"class="blue">刪除</a></td>
         </tr>
         <trclass="shopping_product_list"id="shoppingProduct_05">
         <tdclass="shopping_product_list_1"><ahref="#"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"class="blue">PHP和MySQL Web開發(fā) (原書第4版)</a></td>
         <tdclass="shopping_product_list_2"><label>712</label></td>
         <tdclass="shopping_product_list_3">¥<label>95.00</label></td>
         <tdclass="shopping_product_list_4">¥<label>71.20</label> (75折)</td>
         <tdclass="shopping_product_list_5"><inputtype="text"value="1"/></td>
         <tdclass="shopping_product_list_6"><ahref="javascript:void(0)"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"class="blue">刪除</a></td>
         </tr>
         <trclass="shopping_product_list"id="shoppingProduct_06">
         <tdclass="shopping_product_list_1"><ahref="#"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"class="blue">法布爾昆蟲記</a>(再買¥68.30即可參加“滿199元減10元現(xiàn)金”活動)</td>
         <tdclass="shopping_product_list_2"><label>10</label></td>
         <tdclass="shopping_product_list_3">¥<label>198.00</label></td>
         <tdclass="shopping_product_list_4">¥<label>130.70</label> (66折)</td>
         <tdclass="shopping_product_list_5"><inputtype="text"value="1"/></td>
         <tdclass="shopping_product_list_6"><ahref="javascript:void(0)"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"rel="external nofollow"class="blue">刪除</a></td>
         </tr>
         </table>
         <pclass="shopping_list_end">
         <p><aid="removeAllProduct"href="javascript:void(0);"rel="external nofollow">清空購物車</a></p>
         <ul>
         <liclass="shopping_list_end_1"><inputname=""type="image"src="images/shopping_balance.gif"/></li>
         <liclass="shopping_list_end_2">¥<labelid="product_total"></label></li>
         <liclass="shopping_list_end_3">商品金額總計:</li>
         <liclass="shopping_list_end_4">您共節(jié)省金額:¥<labelclass="shopping_list_end_yellow"id="product_save"></label><br/>
         可獲商品積分:<labelclass="shopping_list_end_yellow"id="product_integral"></label>
         </li>
         </ul>
         </p>
         </p>
         </body>
        </html>

        相信看了本文案例你已經(jīng)掌握了方法,更多精彩請關(guān)注Gxl網(wǎng)其它相關(guān)文章!

        推薦閱讀:

        jquery插件擴展使用詳解

        jQuery判斷瀏覽器版本的方法

        jQuery表格頂欄固定效果

        聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        jQuery實現(xiàn)購物車添加商品并結(jié)算

        jQuery實現(xiàn)購物車添加商品并結(jié)算:這次給大家?guī)韏Query實現(xiàn)購物車添加商品并結(jié)算,jQuery實現(xiàn)購物車添加商品并結(jié)算的注意事項有哪些,下面就是實戰(zhàn)案例,一起來看一下。<!DOCTYPE html> <html> <head> <metacharset="UTF-8"&
        推薦度:
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 有码人妻在线免费看片| 亚洲中文字幕久久久一区| 一级a性色生活片久久无少妇一级婬片免费放 | 免费人成视频在线| 亚洲综合av一区二区三区| av无码免费一区二区三区| 精品人妻系列无码人妻免费视频| 国产高清视频在线免费观看| 亚洲国产成人精品无码区花野真一 | 亚洲免费综合色在线视频| 97久久国产亚洲精品超碰热| 久久久久久久久免费看无码| 亚洲日产乱码一二三区别| 国产在线a不卡免费视频| 又硬又粗又长又爽免费看 | 亚洲成aⅴ人片在线影院八| 免费看片在线观看| 亚洲国产成人久久精品大牛影视| 免费在线观看亚洲| 成人免费ā片在线观看| 无码欧精品亚洲日韩一区| 亚洲人成免费电影| 日韩成人精品日本亚洲| 国产成人免费高清激情明星| 亚洲mv国产精品mv日本mv| 国产小视频在线观看免费| 免费看美女午夜大片| 亚洲精品成人无码中文毛片不卡| 久艹视频在线免费观看| 亚洲AV男人的天堂在线观看| 免费亚洲视频在线观看| 国产无限免费观看黄网站| 亚洲综合免费视频| a级成人毛片免费视频高清| 女人18毛片水真多免费看 | 久久青草精品38国产免费| 亚洲永久在线观看| 久久久久国产亚洲AV麻豆| 国产人成免费视频网站| 日本中文字幕免费看| 亚洲网站在线播放|