jQuery实现简单的纯前端的购物车案例( 三 )

=list.length){tb.append("");}else{str+=`${list[i].name}${list[i].brand}${list[i].country}${list[i].price}0删除`;}}tb.append(str);}//select添加option函数function addselect(){var arr=[];for(var i=0;i请选择");for(var i=0;i"+new_arr[i]+"");}}var optiontext="请选择";var list = [{name: "奥托",brand: "铃木",country: "中国",price: "20000"}, {name: "奥托",brand: "铃木",country: "美国",price: "20000"}, {name: "奥托",brand: "铃木",country: "德国",price: "20000"}, {name: "奥托",brand: "铃木",country: "中国",price: "20000"}, {name: "奥托",brand: "铃木",country: "中国",price: "20000"}, {name: "奥托",brand: "铃木",country: "中国",price: "20000"}, {name: "奥托",brand: "铃木",country: "美国",price: "20000"}, {name: "奥托",brand: "铃木",country: "德国",price: "20000"}, {name: "奥托",brand: "铃木",country: "中国",price: "20000"}, {name: "奥托",brand: "铃木",country: "法国",price: "20000"},];
主页面index.html代码:
table td{width: 100px;border:1px solid #0094ff;text-align: center;}th{border:1px solid #0094ff;}.input_num{width: 20px;text-align: center;}#heji{font-size: 30px;color:red ;margin-left: 650px;}车型:   国家:    
名称品牌产地价格数量合计操作

子页面代码:
【jQuery实现简单的纯前端的购物车案例】>$(function(){$("#btn").click(function(){var name=$("#name").val();var pinpai=$("#pinpai").val();var chandi=$("#chandi").val();var price=$("#price").val();var list1={name:name,brand:pinpai,country:chandi,price:price};window.opener.list.push(list1);// console.log( window.opener.list);window.opener.$("table").children("tbody").children("tr").remove();window.opener.init( window.opener.list);window.opener.$("select").children("option").remove();window.opener.addselect();// window.close();});})名称:
品牌:
产地:
价格:


乾坤未定 , 你我皆是黑马!!!
相信你将来也会成为一位大牛