if, else statement not sure why it's not working
Hi,
I'm trying to break my problem down to smaller bit and I thought an if..else statement (or in this case if..if.. because I keep getting an error with if..else in my dreamweaver program) would help but it's not working...
<script language="javascript">
function processSubTotalA()
{
var quantity = parseInt(document.MarinaServices.txtLOA.value);
var unitPrice = parseFloat(document.MarinaServices.txtMoorPrice.value);
var subTotalA = unitPrice * quantity;
if(quantity <30);
{
(isFlatRate = true);
(flatRate = 1599);
(flatRate = unitPrice);
(flateRate = subTotalA);
}
if(quantity >30);
{
(isPerFoot = true);
(unitPrice = 55);
(perFoot = unitPrice);
(subTotalA = unitPrice * quantity);
}
document.MarinaServices.txtServiceASubTotal.value = serviceASubTotal.toFixed(2);
}
function calculateTaxAmount(price, tax)
{
var amount = price * tax / 100;
return amount;
}
function processMoor()
{
var MoorTotal;
var subTotalB = parseFloat(document.MarinaServices.txtServiceASubTotal.value);
var subTotalB = subTotalA;
var taxRate = parseFloat(document.MarinaServices.txtTaxRate.value);
var taxAmount = calculateTaxAmount(serviceBSubTotal, taxRate);
var moorTotal = serviceBSubTotal + taxAmount;
document.MarinaServices.txtServiceBSubTotal.value = serviceBSubTotal.toFixed(2);
document.MarinaServices.txtTaxAmount.value = taxAmount.toFixed(2);
document.MarinaServices.txtMoorTotal.value = moorTotal.toFixed(2);
}
</script>
<script language="javascript">
function processServiceASubTotal()
{
var unitPrice = parseFloat(document.MarinaServices.txtMoorPrice.value.value);
var quantity = parseInt(document.MarinaServices.txtLOA.value);
var subTotalA = unitPrice * quantity;
if(quantity <30);
{
(isFlatRate = true);
(flatRate = 1599);
(flatRate = unitPrice);
(flateRate = subTotalA);
}
if(quantity >30);
{
(isPerFoot = true);
(unitPrice = 55);
(perFoot = unitPrice);
(subTotalA = unitPrice * quantity);
}
document.MarinaServices.txtMoorPrice.value = moorPrice.toFixed(2);
document.MarinaServices.txtServiceASubTotal.value = serviceASubTotal.toFixed(2);
}
function calculateTaxAmount(price, tax)
{
var amount = eval(price * tax / 100);
return amount;
}
function processMoorTotal()
{
var SubTotalA;
var subTotalA = parseFloat(document.MarinaServices.txtServiceASubTotal.value);
var subTotalB = eval(subTotalA);
var taxRate = parseFloat(document.MarinaServices.txtTaxRate.value);
var taxAmount = calculateTaxAmount(subTotalB, taxRate);
var moorTotal = eval(subTotalB + taxAmount);
document.MarinaServices.txtServiceBSubTotal.value = serviceBSubTotal.toFixed(2);
document.MarinaServices.txtTaxAmount.value = taxAmount.toFixed(2);
document.MarinaServices.txtMoorTotal.value = moorTotal.toFixed(2);
}
</script>
</head>
<body>
<table width="800" border="0" cellspacing="0" cellpadding="0">
<div id="wrap">
<form action="" id="MarinaServices" name="MarinaServices" onsubmit="return false,">
<tr>
<th scope="col"><table width="100%" border="0">
<tr>
<td align="left" nowrap="nowrap"><label for="SUMMER_Moor_LOA_Boat" class="sublabel"> <strong>Summer Mooring:</strong><br />
May 1- Oct.31</label></td>
<td align="left"> <span class="style59">*</span>
<input id="txtLOA" input="input" name="txtLOA" type="text" class="formTextfield_XSmall" value="<?php echo((isset($_GET["invalid"])?ValidatedField("MarinaServices","txtLOA"):"")); ?>" size="4" tabindex="33" onblur="hideServerError('txtLOA_ServerError');" />
Ft. LOA</td>
<td><span class="style59">*</span> $
<input id="txtMoorPrice" input="input" name="txtMoorPrice" type="text" class="formTextfield_XSmall" value="<?php echo((isset($_GET["invalid"])?ValidatedField("MarinaServices","txtMoorPrice"):"")); ?>" size="11" tabindex="34" onblur="hideServerError('txtMoorPrice_ServerError');" />
/ft</td>
<td><input name="btnMoor" type="button" onclick="processMoor()" value="Calc." tabindex="35" /></td>
<td>Sub Total $
<input type="text" name="txtServiceASubTotal" class="formTextfield_Small" size="8" value="0.00" tabindex="36" /></td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td> </td>
<td colspan="5"><input name="btnCalculate" type="button" onclick="processMoor()" value="Calc. Tax/Total" tabindex="37" /></td>
</tr>
<tr>
<td colspan="2" >Sub Total:$
<input name="txtServiceBSubTotal" type="text" class="formTextfield_Small" value="0.00" size="8" tabindex="38" /></td>
<td>Tax Rate</td>
<td><input name="txtTaxRate" type="text" class="formTextfield_XSmall" value="6.25" size="5" tabindex="39" />
%</td>
<td>Tax Amount:$
<input name="txtTaxAmount" type="text" class="formTextfield_Small" value="0.00" size="8" tabindex="40" /></td>
<td>Mooring Total: $
<input name="txtMoorTotal" type="text" class="formTextfield_Small" value="0.00" size="8" tabindex="41" /></td>
</tr>
</table>
<table width="100%" border="0">
<tr> </tr>
</table>
</form>
</div>
</th>
</tr>
</table>
</script>
</body>
</html>
I'm only working on the top section of this form.
And yes I did request one on one help session, but if you could look at this in the mean time I would be greatful.
Thanks