|
|
|
ขอความช่วยเหลือครับ Auto Update จำนวนและราคาตามรูปครับ |
|
|
|
|
|
|
|
Code (JavaScript)
<script type="text/javascript">
var Count = Int('#Price'.val();
$("#AddItem").click(function() {
//Count++;
//$('#TotalPrice').val(parseInt($('#Price'.val())*Count);
$('#TotalPrice').val(parseInt($('#TotalPrice').val() + parseInt($('#Price').val());
}
$("#DelItem").click(function() {
//Count++;
$('#TotalPrice').val(parseInt($('#TotalPrice').val() - parseInt($('#Price').val());
}
</script>
ประมาณนี้หรือเปล่าน่ะ
|
|
|
|
|
Date :
2017-05-31 17:37:20 |
By :
ccjpn |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตอนนี้ผมใช้วิธีนี้ครับ แก้ปัญหาเฉพาะหน้าไปก่อน
Code (JavaScript)
<script>
var clicks = 0
price = 0
price1 = 0,
counterSpan = document.getElementById('clicks');
counterSpan = document.getElementById('price');
counterSpan = document.getElementById('price1');
//add the click listener using addEventListener, this is preferred over inline handlers
document.getElementById('my-pre').addEventListener('click', function () {
clicks += 1,
price += 25.00;
price1 += 25.00,
document.getElementById("clicks").innerHTML = clicks;
document.getElementById("price").innerHTML = price;
document.getElementById("price1").innerHTML = price1;
});
var clicks = 0
price = 0
price1 = 0,
counterSpan = document.getElementById('clicks');
counterSpan = document.getElementById('price');
counterSpan = document.getElementById('price1');
//add the click listener using addEventListener, this is preferred over inline handlers
document.getElementById('my-pre1').addEventListener('click', function () {
clicks -= 1,
price -= 25.00,
price1 -= 25.00,
document.getElementById("clicks").innerHTML = clicks;
document.getElementById("price").innerHTML = price;
document.getElementById("price1").innerHTML = price1;
});
</script>
|
|
|
|
|
Date :
2017-05-31 19:29:49 |
By :
Junior.J |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ข้อความซ้ำครับ ขออภัยครับ
|
ประวัติการแก้ไข 2017-05-31 19:32:26
|
|
|
|
Date :
2017-05-31 19:30:42 |
By :
Junior.J |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ข้อความซ้ำครับ ขออภัยครับ
|
ประวัติการแก้ไข 2017-05-31 19:32:55
|
|
|
|
Date :
2017-05-31 19:31:17 |
By :
Junior.J |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2017-07-23 16:40:00 |
By :
tommyna |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|