原生js实现购物车

本文详细介绍了如何利用JavaScript原生代码实现购物车的基本操作,包括添加商品、删除商品、修改商品数量以及查询购物车状态。通过实例代码,帮助读者理解JavaScript在电商应用中的实际运用。
摘要由CSDN通过智能技术生成

原生就js实现购物车增删改查。。。在这里插入图片描述

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			*{
   
				margin:0;padding:0;
			}
			.fl{
   
				float: left;
			}
			.fr{
   
				float: right;
			}
			.clearfix{
   
				clear: both;
				zoom: 1;
			}
			.shopping{
   
				width: 1200px;
				margin: 0 auto;
				font-size: 14px;
			}
			.shopping .header{
   
				width: 100%;
				height: 50px;
				line-height: 50px;
				background: #ccc;
				color: #000000;
				font-weight: bold;
				text-align: left;
			}
			.shopping .header ul{
   
				padding-left: 30px;
			}
			.shopping .header ul li{
   
				width: 190px;
				list-style: none;
			}
			.shopping .footer{
   
				width: 100%;
				height: 50px;
				background: #ccc;
				color: #000000;
				text-align: left;
			}
			.shopping .footer .footlf{
   
				width: 200px;
				line-height: 50px;
				margin-left: 30px;
			}
			.shopping .footer .footrg{
   
				width: 600px;
				text-align:right;
			
			}
			.shopping .footer .footrg span:nth-child(1){
   
				display: inline-block;
				padding: 0px 25px;
				background: black;
				color: white;
				line-height: 48px;
				margin-right: 20px;
			}
			.shopping .footer .footrg span:nth-child(2),.shopping .footer .footrg span:nth-child(3){
   
				display: inline-block;
				margin-right: 20px;
			}
			.shopping .footer .footrg span:nth-child(4){
   
				font-size:16px;
				font-weight: bold;
				line-height: 50px;
				margin-right: 50px;
			}
			.shopping .footer .footrg s{
   
				color: red;
			}
			.content{
   
				margin: 10px 0px;
			}
			.content dl{
   
				margin-bottom: 20px;
			}
			.content dl dt{
   
				border: 1px solid #CCCCCC;
				height: 30px;
				line-height: 30px;
				font-weight: bold;
			}
			.content dl dt{
   
				padding-left: 20px;
			}
			.content dl dd{
   
				padding-left: 20px;
				border: 1px solid #CCCCCC;
				height: 100px;
				line-height: 100px;
				border-top: none;
			}
			.content dl dd ul li{
   
				list-style: none;
			}
			.content dl dd ul li img{
   
				width: 80px;
				height: 80px;
				vertical-align: middle;
			}
			.content dl dd ul li{
   
				width: 190px;
			}
			.content dl dd ul li s{
   
				color: red;
				font-weight: bold;
			}
			.content dl dd ul li input{
   
				width: 30px;
			}
			s{
   
				text-decoration: none;
			}
			.content .del{
   
				cursor: pointer;
			}
			.minus{
   
				padding: 0px 10px;
				background: red;
				cursor: pointer;
			}
			.plus{
   
				padding: 0px 10
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值