"missing ; before statement" error - Urgent

Hi

I'm stuck and can't figure out where in this code I'm going wrong. Thanks in advance for your help:

function updatetotalcharge()      {
  Svc_Amount() =  (document.form1.SVC_AMT() - 0);
  ItemTip() = (document.form1.TIP -0);
  document.form1.totalCharge.value = 0;

             for (var i = 1; i < Svc_Amount.length; i++)
            document.form1.totalCharge.value = document.form1.totalCharge.value + Svc_Amount{i].value + ItemTip[i].value;
      
}
      
lynwallAsked:
Who is Participating?
 
archrajanConnect With a Mentor Commented:
one more thing is
instead of this
document.form1.SVC_AMT()  
write it as

document.form1.elements['SVC_AMT()']
0
 
BatalfCommented:
You're refering to Svc_amount{i]

it should be

Svc_amound[i].

And perhaps these lines also has to be changed

Svc_Amount() =  (document.form1.SVC_AMT() - 0);
  ItemTip() = (document.form1.TIP -0);

in case this a way of putting elements into array.

example:


<script>
function updatetotalcharge()     {
  Svc_Amount.push(document.form1.SVC_AMT() - 0);
  ItemTip.push(document.form1.TIP -0);
  document.form1.totalCharge.value = 0;

  for (var i = 1; i < Svc_Amount.length; i++)
          document.form1.totalCharge.value = document.form1.totalCharge.value + Svc_Amount[i].value + ItemTip[i].value;
     
}
</script>
0
 
lynwallAuthor Commented:
Thanks! That was it!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.