は私のスクリプトです:Javascriptが1より大きくインクリメントされていますか?ここ
//event handler for item quantity in shopping cart
function itemQuantityHandler(p, a) {
//get current quantity from cart
var filter = /(\w+)::(\w+)/.exec(p.id);
var cart_item = cart[filter[1]][filter[2]];
var v = cart_item.quantity;
//add one
if (a.indexOf('add') != -1) {
if(v < settings.productBuyLimit) v++;
}
//substract one
if (a.indexOf('subtract') != -1) {
if (v > 1) v--;
}
//update quantity in shopping cart
$(p).find('.item-quantity').text(v);
//save new quantity to cart
cart_item.quantity = v;
//update price for item
$(p).find('.item-price').text((cart_item.price*v).toFixed(settings.numberPrecision));
//update total counters
countCartTotal();
}
私は必要なもの以上で "V"(cart_item.quantity)を高めることです。ここでは、 "v ++"を使用しています...しかし、それは1だけ増加しています。これを変更して、プラスアイコンをクリックするたびに4ずつ増やす方法はありますか?
私は
v++ +4
をしようとしたが、それは働いていません。
ありがとうございました!以上によりインクリメントする V + = N
'v + = 4' ...?そしていくつかの埋め込み... –
数字に4を追加する方法がわからない場合は、基本的なプログラミングチュートリアルを実行することをお勧めします。 –