• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4522
  • Last Modified:

"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;
      
}
      
0
lynwall
Asked:
lynwall
1 Solution
 
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
 
archrajanCommented:
one more thing is
instead of this
document.form1.SVC_AMT()  
write it as

document.form1.elements['SVC_AMT()']
0
 
lynwallAuthor Commented:
Thanks! That was it!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now