I an new to Javascript, I have coded a form to estimate the cost of accommodation. It is doing everything OK but I need to add an if statement. For example: If nights = 4 or < 7 then they get the discount. I have got the discount organised but not sure how or where to add the if statement. If they stay 7 nights then they get a night free (135). Need to add this too. Do I need a new function? Your help would be appreciated. Thanks
Code:<SCRIPT language = JavaScript>
function calculate() {
A = document.frmOne.txtNights.value
B = document.frmOne.txtTwoAdults.value
C = document.frmOne.txtExtraAdults.value
D = document.frmOne.txtChildren.value
A = Number(A)
B = Number(B)
C = Number(C)
D = Number(D)
E = (A * 135)
document.frmOne.txtTot2Ads.value = E
F = (A * C)*35;
document.frmOne.txtXads.value = F
G = (A * D)*15;
document.frmOne.txtkids.value = G
H = (E + F + G)
document.frmOne.txtCost.value = H
I = (H * 10)/100;
document.frmOne.discount.value = I
}
</SCRIPT>