shopping cart image創建購物車的網站,subprice問題
我想創建subprice功能,顯示在colomn,但我不知道如何從第一個ID下面的數量打印subprice,請幫我:d 這個代碼是顯示了subprice
<div class="col-sm-2 text-center" id="test">
<script>
$("input[name=quantity0]").on("keydown",function(){
id= "<?php echo $id ;?>";
var price;
quantity=$("input[name=quantity0]").val();
for(i=0;i<carts.length;i++){
if(id==1){
price=30;
total=price*quantity;
$("#test").text("$"+total);
}
if(id==2){
price=30;
total=price*quantity;
$("#test").text("$"+total);
}
if(id==3){
price=30;
total=price*quantity;
$("#test").text("$"+total);
}
if(id==4){
price=30;
total=price*quantity;
$("#test").text("$"+total);
}
if(id==5){
price=30;
total=price*quantity;
$("#test").text("$"+total);
}
if(id==6){
price=30;
total=price*quantity;
$("#test").text("$"+total);
}
if(id==7){
price=30;
total=price*quantity;
$("#test").text("$"+total);
}
if(id==8){
price=30;
total=price*quantity;
$("#test").text("$"+total);
}
if(id==9){
price=30;
total=price*quantity;
$("#test").text("$"+total);
}
if(id==10){
price=30;
total=price*quantity;
$("#test").text("$"+total);
}
}
});
</script>
</div>
我在你們需要試着去了解問題的情況下上傳它在我的網站http://scellion.hol.es/:d
這裏是你的代碼? – mlegg
現在上傳我的代碼 – Sam
ummm即時通訊新的,你們可以告訴我如何創建代碼框? :D – Sam