01.
if
(document.messageCheckbox.checked ==
true
){
02.
$(
'.messageCheckbox'
).click(
function
(){
03.
var
priceID=$(
this
).val();
04.
var
priceold=parseInt($(
'#showprice'
).html());
05.
fieldNum++;
06.
$(
'#fieldNum'
).html(fieldNum);
07.
$.get(
'checkprice.php?price='
+priceID,
function
(data){
08.
09.
var
pricenew= priceold + parseInt(data);
10.
$(
'#showprice'
).html(pricenew);
11.
});
12.
}
else
{
13.
$(
'.messageCheckbox'
).click(
function
(){
14.
var
priceID=$(
this
).val();
15.
var
priceold=parseInt($(
'#showprice'
).html());
16.
fieldNum--;
17.
$(
'#fieldNum'
).html(fieldNum);
18.
$.get(
'checkprice.php?price='
+priceID,
function
(data){
19.
20.
var
pricenew= priceold - parseInt(data);
21.
$(
'#showprice'
).html(pricenew);
22.
});
23.
}