//购物车数量的自增自减 function qtyUpdate(kind,obj){ var count = 0; if(kind == "up"){ var tmp=obj.prev(); count=$(tmp).val(); count++; $(tmp).val(count); }else if(kind == "down"){ if(count > 1) { var ne=obj.next(); count=$(ne).val(); count--; $(ne).val(count); } } }
---------------------------------------******************正解******************----------------------------------------
//购物车数量的自增自减 function qtyUpdate(kind,obj){ var count = 0; if(kind == "up"){ var tmp=$(obj).prev(); count=$(tmp).val(); count++; $(tmp).val(count); }else if(kind == "down"){ var ne=$(obj).next(); count=$(ne).val(); if(count > 1) { count--; $(ne).val(count); } } }