problem with calculating order form

admin

Administrator
Staff member
I need some help on a javascript form I built a year ago which calculates the total price with shipping. I'm using the code on a different site and trying to link it to a merchant account system, however I am having a problem renaming the 'toal' text field to match the merchant's requirements for
submission. I need to change the value of the total field to 'chargetotal', but I'm not sure whatelse to change in the script. Here is the script which calculates the form total:

script language = "JavaScript">


function calculate(form){
// form holds the value sent by this.form below
// this.form holds info about the form it is inside
var cost = 0;
var cost2 = 0;

for(v=0;v<form.styles.length;v++){
if(form.styles[v].selected){
cost = form.styles[v].value;

}
}
for(v=0;v<form.style2.length;v++){
if(form.style2[v].selected){
cost2 = form.style2[v].value;

}
}


q= 1*form.quantity.value+1*form.quantity1.value
sh= 0.00
if (q > 2){sh=0.00}

t = form.quantity.value*cost+form.quantity1.value*cost2+sh
t1= t*100
t1=t1%10
if(t1==0){
ez="0"
}
else{
ez=""
}
t1=t*100
t1%100
if(t1==0){
ez=".00"
}

form.total.value=t+ez;

}


</script>

Here is the text field which displays the total value:

input type="text" name="total" value=http://www.webdeveloper.com/forum/archive/index.php/"00.00" size="10" maxlength="10">

I changed the value to'chargetotal' and changed the only value I see in the script, however it didn't work. Is there something else that needs to be changed in the script?
This is driving me crazy!
 
Back
Top