Forum Moderators: open

Message Too Old, No Replies

Error in If statement in javascript (Newbie)

         

SuziQ

2:25 am on Mar 22, 2004 (gmt 0)

10+ Year Member



I've designed a script to OnClick total the costs for a user registering for a course. Initially participants value 1 works fine. Then whenever I change the participants value to any other number the script works great. However, when I try to change the participants value back to 1 the discounts don't apply properly (it retains the discount from the previous entry). I'm sure it's just a simple error in my code, or a need to refresh but I can't find it... Any help would be appreciated.

if (document.ThisForm.participants.value=="1") {
discounts = 0;
} else {
discounts = Math.abs(document.ThisForm.subtotal.value*10)/100;
document.ThisForm.discounts.value = Math.round(discounts*100)/100;}

Purple Martin

2:41 am on Mar 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if (document.ThisForm.participants.value=="1") {
document.ThisForm.discounts.value = 0;
} else {
discounts = Math.abs(document.ThisForm.subtotal.value*10)/100;
document.ThisForm.discounts.value = Math.round(discounts*100)/100;}

SuziQ

2:48 am on Mar 22, 2004 (gmt 0)

10+ Year Member



I knew I'd been staring at it too long! :s
I really love the collective expertise on this site.

Thanks for the prompt reply Purple Martin!