购物车cart.css@charsetutf-8;/*CSSDocument*//*中间导航*/#nav{width:985px;/*内容固定宽度*/margin:0pxauto;/*固定宽度且居中*/height:39px;}#middle#allnav{width:100%;/*自适应宽度,占据整个屏幕*/height:39px;background-color:#ff7701;}#navulli{float:left;}#navullia{float:left;/*兼容ie6*/padding:0px16px;height:39px;line-height:39px;display:block;font-weight:bold;font-size:15px;color:white;}#navullia:hover{background-color:#ff8c00}#navullia.category{background-image:url(../images/arrow-down.gif);background-repeat:no-repeat;background-position:right;}/*导航菜单的二级菜单用到定位*/#navulli.menuList{position:relative;}#navulli.menuListul{background-color:#ff7701;text-align:center;top:39px;/*脱离原文档流*/left:0px;position:absolute;width:123px;display:none;}#navulli.menuList:hoverul{display:block;}#navulliulli{float:none;}#navulliullia{float:none}#middle#content{width:985px;margin:20pxauto;}/*中间第二块:订单表*/#middle#ordertable{padding:20px;/*和边框有间隔*/border:1pxsolid#dedede;overflow:hidden;/*解决父元素的浮动塌陷*/}#ordertableulli{float:left;height:78px;/*和购物车图像的高度一致*/font:bold25px/78pxVerdana,Geneva,sans-serif;}#ordertableulli.step{background:url(../images/cart/step1.jpg)no-repeatcenter;width:679px;margin-left:30px;}#ordertable.btn{border:1pxsolid#dedede;background-color:white;width:16px;height:16px;}#ordertable.txt{width:60px;height:30px;border:1pxsolid#dedede;text-align:center;font:bold15px/30pxVerdana,Geneva,sans-serif;}#ordertable.txt:hover{border:1pxsolidred}#ordertabletable{border:1pxsolid#dedede;border-collapse:collapse;width:100%;clear:both;}#ordertabletabletr{height:50px;border-bottom:1pxdashed#dedede;}#ordertabletabletd,#ordertableth{text-align:center;vertical-align:central;}/*对单元格的宽度细调*/#ordertabletabletd.item{width:260px;height:60px;text-align:left;}#ordertabletabletd.itemimg{margin-right:10px;vertical-align:baseline;}/*汇总的一行*/#ordertabletabletrtd.cal{text-align:right;}#ordertabletabletrtd.calspan{font:bold25pxVerdana,Geneva,sans-serif;color:orange;}/*提交订单的按钮*/#ordertablep{text-align:right;}/*最近浏览*/#middle#lastview{margin-top:20px;border:1pxsolid#dedede;padding:20px;overflow:hidden;/*浮动塌陷*/}#lastviewdl{float:left;height:222px;width:210px;margin-right:20px;}#lastviewdldd{line-height:25px;}#lastviewdlddspan{font:bold15pxVerdana,Geneva,sans-serif;color:#C30;}#lastviewdldd.price{float:left;}#lastviewdldd.num{float:right}#lastviewdldd.add{clear:both;float:right;}#lastviewdldd.adda{color:#F90}#lastviewdldd.adda:hover{text-decoration:underline;}#lastviewdldd.addspan{background:url(../images/icon.gif)0px-85px;width:18px;height:33px;display:block;float:left;margin-top:2px;}global.cssbody{font-family:verdana,helvetica,arial,sans-serif;padding:20px;font-size:12px;margin:0;}*{margin:0px;padding:0px;font-size:12px;}aimg{border:none}a{text-decoration:none;color:Black;}a:hover{color:Orange;}ul{list-style:none;}h2{font-size:18px;font-weight:bold;margin:0;margin-bottom:15px;}.demo-info{padding:0012px0;}.demo-tip{display:none;}cart.html!DOCTYPEhtmlPUBLIC-//W3C//DTDXHTML1.0Transitional//EN==Content-Typecontent=text/html;charset=utf-8/title购物车/titlelinkhref=css/global.csstype=text/cssrel=stylesheet/linkhref=css/cart.csstype=text/cssrel=stylesheet/styletype=text/css/*放大图片的样式*/img#imgTip{position:absolute;border:1pxsolid#ccc;padding:3px;width:120px;height:85px;display:none;background-color:#eee;}/stylescriptsrc=js/jquery-1.11.0.min.js/scriptscripttype=text/javascriptfunctioncheck(){varcb1=document.getElementById(allCb);varchs=document.getElementsByName(item);for(vari=0;ichs.length;i++){chs[i].checked=cb1.checked;}}$(function(){varx=5,y=15;//初始化提示图片位置//小图片鼠标移动事件$(tableimg).mouseover(function(e){$(#imgTip).attr(src,this.src)//设置图片的src属性.css({top:(e.pageY+y)+px,left:(e.pageX+x)+px})//设置提示图片的位置.show(1000);//显示图片});//小图片移除事件$(tableimg).mouseout(function(){$(#imgTip).hide();//隐藏图片});$(.btnMinus).click(function(){//绑定单击减少数量的按钮事件vartxtObj=$(this).siblings(input[type='text']);//获取按钮type='text'的兄弟varnumber=parseInt(txtObj.val());if(number1){txtObj.val(number-1);//小计某个商品的总价calPrice($(this),number-1);calTotalPrice();}});$(.btnAdd).click(function(){//绑定单击增加数量的按钮事件vartxtObj=$(this).siblings(input[type='text']);//获取按钮type='text'的兄弟varnumber=parseInt(txtObj.val());txtObj.val(number+1);//小计某个商品的总价calPrice($(this),number+1);calTotalPrice();});});//小计团购项目的价格functioncalPrice($BtnObj,number){var$tdObj=$BtnObj.parent().next();//获取显示单价的td单元格varprice=parseFloat($tdObj.text().substr(1));//获取单价var$tdObjTotal=$tdObj.next();//获取紧跟的同胞元素,即显示商品小计的单元格vartotal=price*number;//计算总价$tdObjTotal.html(¥+total.toFixed(2));//商品小计小数点保留两位后显示}//计算所有团购项目的总价格functioncalTotalPrice(){varsum=0;//保存总价//遍历表格的索引是5的单元格$(#tabOrdertd[title='price']).each(function(){sum=sum+parseFloat($(this).text().substr(1));//价格的累加});//显示总价$(#spanTotal).html(¥+sum);}/script/headbodydivid=contentdivid=ordertableulliimgsrc=img/cart/g1.jpg//lili我的购物车/liliclass=step/li/ulformtableid=tabOrdertrth