Guys
I need to determine which textbox to return a value to using javascript.
In the code below, I need the value 'premtype' to be either prem or alt_prem depending on the radio button selected. I just can't seem to figure out how to pass the variable into the 'document.frm.variablehere.value' statement:
Code://check if renewal premium or alternative renewal premium has been chosen.... if (document.frm.choice[0].checked)//renewal premium { total = document.frm.prem.value premtype = "prem" } else {//alt renewal premium total = document.frm.alt_prem.value premtype = "alt_prem" } //work out premiums....... if (stmt == true)//checkbox checked.... { //calculate the new premium amount total = parseFloat(total) + parseFloat(changeBy); //populate premium field document.frm.premtype.value = Math.abs(total).toFixed(2); } else//checkbox unchecked.... { //calculate the new premium amount total = parseFloat(total) - parseFloat(changeBy); //populate 'prem' field document.frm.premtype.value = Math.abs(total).toFixed(2); }
I hope this makes sense!
Cheers




Reply With Quote