开发者

how to update the value for display in jquery/html

hi i have the confusion with my jquery. i have d 4 button to update the value.

let me explain it clearly

this four buttons are select method for an amount. my project is based upon the labtop and iphones. by the shopping cart customer choose the product and then they have to select the button(any 4 in those buttons)

if customer cart amount is 50£ in the sense then they need to choose the radio button if customer select 2 button in the sense the 2nd button amount must add with shopping cart and then displayed like a 55£

if i click the button there is no change when mouse arrow is on the button i could see the error page in below. what action i need to put for the changes i mean the action for the radio button.

<form method="post" form name="make_payment_frm" 
     action="module/make-payment-module.php" 
     onsubmit="return show_make_payment_validation();" >
<input type="radio" name="rmr"  id="payment1" value="30"  
onclick="updatepayment(this.value)" />
<input type="radio" name="rmr" id="payment2" value="39" 
   onclick="updatepayment(this.value)" />
<input type="radio" name="rmr"  id="payment3" value="42" 
   onclick="updatepayment(this.value)" />
<input type="radio" name="rmr" id="payment4" value="45" 
   onclick="updatepayment(this.value)" />
<input type="hidden" name="totalamount" id="totalamount" 
   value="<?php echo get_total_amount(); ?>" />

$(document).ready(function(){ 
      $("input[name='rmr']").click(function() {
       updatePayment($(this).val());
       if (!!$(this).attr("checked") == true) {
         $("#finalamount").html(
          parseInt($("#totalamount").val(), 10) * parseInt($(this).val(), 10));
     }
 });
}

var totalAmount = 50.0; //Set from the database 
function updateAmount(var additionalCost) 
{ 
    document.getElementById("finalamount").innerHTML = totalAmount 
                    + additionalCost;
} 
document.getElementById('payment1').onclick = function(){ 
updateAmount('30') 
}; 
document.getElementById('payment2').onclick = function(){ 
updateAmount('39') 
}; 
document.getElementById('payment3').onclick = function(){ 
updateAmount('42') 
}; 
 documen开发者_JS百科t.getElementById('payment4').onclick = function(){ 
updateAmount('45') 
};    

guys can any one tell me the good idea for the radio button works properly. that amount must add with that payment cart and then display.is there any thing wrong in my code. plz help me.

thanks and regards magna ``


function updateAmount(var additionalCost)

remove the var there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜