Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need help to remove NaN from toatl calculation field below

Status
Not open for further replies.

data1

Programmer
Aug 19, 2003
25
0
0
NZ

<!DOCTYPE html public &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<HTML>
<HEAD>
<TITLE>Coffee Supply</TITLE>
<SCRIPT language=&quot;JavaScript&quot;>//start of calculation function for Brazillian
function calculate(){
var f = document.myForm;
var first = f.brazillianBeans.value;
var second = f.brazillianFilter.value;
var third = f.brazillianPlunger.value;
var fourth = f.brazillianEspresso.value;
var five = parseFloat(first) + parseFloat(second) + parseFloat(third) + parseFloat(fourth);
f.t5.value = five;
f.totalPrice1.value = (five * 18.95) .toFixed(2);
}//end of calculation function for Brazillian



//start of calculation function for bluemountain
function calculate2(){
var f = document.myForm;
var first = f.bluemountainBeans.value;
var second = f.bluemountainFilter.value;
var third = f.bluemountainPlunger.value;
var fourth = f.bluemountainEspresso.value;
var five = parseFloat(first) + parseFloat(second) + parseFloat(third) + parseFloat(fourth);
f.t5a.value = five;
f.totalPrice2.value = (five * 18.95) .toFixed(2);
}//end of calculation function for bluemountain


//start of calculation function for Columbian
function calculate3(){
var f = document.myForm;
var first = f.columbianBeans.value;
var second = f.columbianFilter.value;
var third = f.columbianPlunger.value;
var fourth = f.columbianEspresso.value;
var five = parseFloat(first) + parseFloat(second) + parseFloat(third) + parseFloat(fourth);
f.t5b.value = five;
f.totalPrice3.value = (five * 18.95) .toFixed(2);
}//end of calculation function for columbian


//start of calculation function for Costa Rica
function calculate4(){
var f = document.myForm;
var first = f.costaricaBeans.value;
var second = f.costaricaFilter.value;
var third = f.costaricaPlunger.value;
var fourth = f.costaricaEspresso.value;
var five = parseFloat(first) + parseFloat(second) + parseFloat(third) + parseFloat(fourth);
f.t5c.value = five;
f.totalPrice4.value = (five * 18.95) .toFixed(2);
}//end of calculation function for Costa Rica



//start of calculation function for Espresso
function calculate5(){
var f = document.myForm;
var first = f.espressoBeans.value;
var second = f.espressoFilter.value;
var third = f.espressoPlunger.value;
var fourth = f.espressoEspresso.value;
var five = parseFloat(first) + parseFloat(second) + parseFloat(third) + parseFloat(fourth);
f.t5d.value = five;
f.totalPrice5.value = (five * 18.95) .toFixed(2);
}//end of calculation function for Espresso



//start of calculation function for Kenya
function calculate6(){
var f = document.myForm;
var first = f.kenyaBeans.value;
var second = f.kenyaFilter.value;
var third = f.kenyaPlunger.value;
var fourth = f.kenyaEspresso.value;
var five = parseFloat(first) + parseFloat(second) + parseFloat(third) + parseFloat(fourth);
f.t5e.value = five;
f.totalPrice6.value = (five * 18.95) .toFixed(2);
}//end of calculation function for Kenya



//start of calculation function for New Guinea
function calculate7(){
var f = document.myForm;
var first = f.newguineaBeans.value;
var second = f.newguineaFilter.value;
var third = f.newguineaPlunger.value;
var fourth = f.newguineaEspresso.value;
var five = parseFloat(first) + parseFloat(second) + parseFloat(third) + parseFloat(fourth);
f.t5f.value = five;
f.totalPrice7.value = (five * 18.95) .toFixed(2);
}//end of calculation function for New Guinea



//start of calculation function for Decaffeinated
function calculate8(){
var f = document.myForm;
var first = f.decaffeinatedBeans.value;
var second = f.decaffeinatedFilter.value;
var third = f.decaffeinatedPlunger.value;
var fourth = f.decaffeinatedEspresso.value;
var five = parseFloat(first) + parseFloat(second) + parseFloat(third) + parseFloat(fourth);
f.t5g.value = five;
f.totalPrice8.value = (five * 22.95) .toFixed(2);
}//end of calculation function for Decaffeinated




//start of calculation function for Organic
function calculate9(){
var f = document.myForm;
var first = f.organicBeans.value;
var second = f.organicFilter.value;
var third = f.organicPlunger.value;
var fourth = f.organicEspresso.value;
var five = parseFloat(first) + parseFloat(second) + parseFloat(third) + parseFloat(fourth);
f.t5h.value = five;
f.totalPrice9.value = (five * 22.95) .toFixed(2);
}//end of calculation function for Organic

//start of calculation function for Maxwell House
function calculate10(){
var f = document.myForm;
var one = f.maxwellHouse.value;
f.totalPrice10.value = (one * 19.95) .toFixed(2);
}//end of calculation function for Maxwell House

//start of calculation function for Williams Premium Blended Tea
function calculate11(){
var f = document.myForm;
var one = f.williamspremiumblendedTea.value;
f.totalPrice11.value = (one * 2.95) .toFixed(2);
}//end of calculation function for Williams Premium Blended Tea


//start of calculation function for Milo
function calculate12(){
var f = document.myForm;
var one = f.miLo.value;
f.totalPrice12.value = (one * 11.65) .toFixed(2);
}//end of calculation function for Milo



--------------------------------------------------------
// Help here to remove the answer NaN//
//start of Total calculation
function calculateTotal(){
var f = document.myForm;
var first = f.totalPrice1.value;
var second = f.totalPrice2.value;
var third = f.totalPrice3.value;
var fourth = f.totalPrice4.value
var fifth = f.totalPrice5.value;
var sixth = f.totalPrice6.value;
var seventh = f.totalPrice7.value;
var eighth = f.totalPrice8.value;
var ninth = f.totalPrice9.value
var tenth = f.totalPrice10.value;
var eleventh = f.totalPrice11.value
var twelth = f.totalPrice12.value;

var thirteen = parseFloat(first) + parseFloat(second) + parseFloat(third) + parseFloat(fourth) + parseFloat(fifth) + parseFloat(sixth) + parseFloat(seventh) + parseFloat(eighth) + parseFloat(ninth) + parseFloat(tenth) + parseFloat(eleventh) + parseFloat(twelth);
f.totalValue.value = thirteen;
}//end of Total calculation

-----------------------------------------------------------



function validate()
{
x=document.myForm;
at=x.myEmail.value.indexOf(&quot;@&quot;);
code=x.myPhone.value;
firstname=x.myFirstname.value;
lastname=x.myLastname.value;
companyname=x.myCompany.value;
submitOK=&quot;True&quot;
if(at==0)
{
alert(&quot;please enter a valid email adderss like mrbean@xtra.co.nz&quot;)
return false
}
if(code<1 || code>7)
{
alert(&quot;Mr Bean say's can you please include your Phone Number Please&quot;)
return false
}
if (firstname.length==0)
{
alert(&quot;Mr Bean say's can you please include your Firstname&quot;)
return false
}
if (lastname.length==0)
{
alert(&quot;Mr Bean say's can you please include your Lastname as well&quot;)
return false
}
if (companyname.length==0)
{
alert(&quot;Mr Bean say's can you please include your Company Name&quot;)
return false
}
else
{
return true
}
}
</SCRIPT>
<SCRIPT language=&quot;JavaScript&quot;><!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName==&quot;Netscape&quot;)&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</SCRIPT>
</HEAD>
<BODY bgcolor=&quot;#ffff66&quot;>
<OBJECT width=&quot;565&quot; height=&quot;400&quot;>
<PARAM name=&quot;movie&quot; value=&quot;images\Mr Bean Movie.swf&quot;>
<EMBED src=&quot;images\Mr Bean Movie.swf&quot; width=&quot;750&quot; height=&quot;530&quot;>
</EMBED>
</OBJECT>
<DIV id=&quot;Layer10&quot; style=&quot;position:absolute; width:349px; height:196px; z-index:11; left: 409px; top: 998px&quot;>
<P><B>Brazillian:&nbsp;
</B>Smooth nutty flavour, full bodied.<BR><B>Blue Mountain:
</B>&nbsp;Popular smooth medium roast,pleasent aftertastemedium
roast.<BR><B>Columbian:
</B>&nbsp; A medium to full bodied coffee with a finely balanced
acidity and rich flavour.<BR><B>Costa Rica:
</B>&nbsp;A warm and spicy medium roast.<BR><B>Espresso:
</B>&nbsp;A classic blend of dark and medium roasted,Provides
a smooth but strong taste.<BR><B>Kenya:&nbsp;
</B>Distinctive sweet bean with a great aroma.<BR><B>New Guinea:
</B>&nbsp;Rich,Smooth and full bodied.<BR><B>Decaffeinated:
</B>&nbsp;Anaturally processed mellow coffee for the health
conscious.<BR><B>Organic:
</B>&nbsp; Naturally growen,pesticide free.<BR><B>More Blends Coming
</B>:&nbsp;Call for full product list.<BR><B>Phone: 575-9048 Fax: 5759049
</B></P>
</DIV><A href=&quot;images/Mr Bean Short 256.wmv&quot;><IMG src=&quot;images/Button1.gif&quot; width=&quot;68&quot; height=&quot;46&quot; border=&quot;0&quot; alt=&quot;&quot;></A>&nbsp;<A href=&quot;PrintView.html&quot;><IMG src=&quot;images/Button2.gif&quot; width=&quot;60&quot; height=&quot;42&quot; border=&quot;0&quot; alt=&quot;&quot;></A>&nbsp;<A href=&quot;products.html&quot;><IMG src=&quot;images/Button3.gif&quot; width=&quot;58&quot; height=&quot;42&quot; border=&quot;0&quot; alt=&quot;&quot;></A>
<FORM name=&quot;myForm&quot; action=&quot;mailto:mrbeancoffee@xtra.co.nz&quot; method=&quot;post&quot; onSubmit=&quot;return validate()&quot; enctype=&quot;text/plain&quot;>
<TABLE cellspacing=&quot;1&quot; cellpadding=&quot;1&quot; border=&quot;0&quot; bgcolor=&quot;#ffff66&quot;>
<TR>
<TH colspan=&quot;12&quot; bgcolor=&quot;black&quot;><FONT color=&quot;white&quot;> EMAIL ORDER FORM (<font size=&quot;1&quot;>All prices qouted exclude gst & freight costs</font>)
</FONT>
</TH>
</TR>
<TR bgcolor=&quot;black&quot;>
<TD><FONT color=&quot;white&quot;> Product &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Price&nbsp;&nbsp;&nbsp;&nbsp;Size

</FONT>
</TD>
<TD><FONT color=&quot;white&quot;> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Beans|
</FONT>
<TD><FONT color=&quot;white&quot;> Filter|
</FONT>
</TD>
<TD><FONT color=&quot;white&quot;> Plunger|
</FONT>
</TD>
<TD><FONT color=&quot;white&quot;> Espresso|
</FONT>
</TD>
<TD><FONT color=&quot;white&quot;> Quantity|
</FONT>
</TD>
<TD><FONT color=&quot;white&quot;> Price
</FONT>
</TD>
<TR>
<TD>Brazillian &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$18.95&nbsp;1KG
</TD>
<TD>
<DIV align=&quot;right&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;brazillianBeans&quot; size=&quot;1&quot; value=&quot;0&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;brazillianFilter&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;brazillianPlunger&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textkbox&quot; name=&quot;brazillianEspresso&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;t5&quot; size=&quot;2&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;totalPrice1&quot; onFocus=&quot;document.myForm.totalPrice1.blur()&quot; readonly=&quot;true&quot; size=&quot;5&quot;>
</DIV>
</TD>
<TD>
<INPUT type=&quot;button&quot; value=&quot;calculate&quot; onClick=&quot;return calculate()&quot;>
</TD>
</TR>
<TR>
<TD>Bluemountain &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$18.95&nbsp;1KG
</TD>
<TD>
<DIV align=&quot;right&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;bluemountainBeans&quot; size=&quot;1&quot; value=&quot;0&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;bluemountainFilter&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;bluemountainPlunger&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textkbox&quot; name=&quot;bluemountainEspresso&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;t5a&quot; size=&quot;2&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;totalPrice2&quot; onFocus=&quot;document.myForm.totalPrice2.blur()&quot; readonly=&quot;true&quot; size=&quot;5&quot;>
</DIV>
</TD>
<TD>
<INPUT type=&quot;button&quot; value=&quot;calculate&quot; onClick=&quot;return calculate2()&quot;>
</TD>
</TR>
<TR>
<TR>
<TD>Columbian &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$18.95&nbsp;1KG
</TD>
<TD>
<DIV align=&quot;right&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;columbianBeans&quot; size=&quot;1&quot; value=&quot;0&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;columbianFilter&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;columbianPlunger&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textkbox&quot; name=&quot;columbianEspresso&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;t5b&quot; size=&quot;2&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;totalPrice3&quot; onFocus=&quot;document.myForm.totalPrice3.blur()&quot; readonly=&quot;true&quot; size=&quot;5&quot;>
</DIV>
</TD>
<TD>
<INPUT type=&quot;button&quot; value=&quot;calculate&quot; onClick=&quot;return calculate3()&quot;>
</TD>
</TR>
<TR>
<TD>Costa Rica &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$18.95&nbsp;1KG
</TD>
<TD>
<DIV align=&quot;right&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;costaricaBeans&quot; size=&quot;1&quot; value=&quot;0&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;costaricaFilter&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;costaricaPlunger&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textkbox&quot; name=&quot;costaricaEspresso&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;t5c&quot; size=&quot;2&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;totalPrice4&quot; onFocus=&quot;document.myForm.totalPrice4.blur()&quot; readonly=&quot;true&quot; size=&quot;5&quot;>
</DIV>
</TD>
<TD>
<INPUT type=&quot;button&quot; value=&quot;calculate&quot; onClick=&quot;return calculate4()&quot;>
</TD>
</TR>
<TD>Espresso&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$18.95&nbsp;1KG
</TD>
<TD>
<DIV align=&quot;right&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;espressoBeans&quot; size=&quot;1&quot; value=&quot;0&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;espressoFilter&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;espressoPlunger&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textkbox&quot; name=&quot;espressoEspresso&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;t5d&quot; size=&quot;2&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;totalPrice5&quot; onFocus=&quot;document.myForm.totalPrice5.blur()&quot; readonly=&quot;true&quot; size=&quot;5&quot;>
</DIV>
</TD>
<TD>
<INPUT type=&quot;button&quot; value=&quot;calculate&quot; onClick=&quot;return calculate5()&quot;>
</TD>
</TR>
<TR>
<TD>Kenya &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$18.95&nbsp;1KG
</TD>
<TD>
<DIV align=&quot;right&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;kenyaBeans&quot; size=&quot;1&quot; value=&quot;0&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;kenyaFilter&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;kenyaPlunger&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textkbox&quot; name=&quot;kenyaEspresso&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;t5e&quot; size=&quot;2&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;totalPrice6&quot; onFocus=&quot;document.myForm.totalPrice6.blur()&quot; readonly=&quot;true&quot; size=&quot;5&quot;>
</DIV>
</TD>
<TD>
<INPUT type=&quot;button&quot; value=&quot;calculate&quot; onClick=&quot;return calculate6()&quot;>
</TD>
</TR>
<TR>
<TD>New Guinea &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$18.95&nbsp;1KG
</TD>
<TD>
<DIV align=&quot;right&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;newguineaBeans&quot; size=&quot;1&quot; value=&quot;0&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;newguineaFilter&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;newguineaPlunger&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textkbox&quot; name=&quot;newguineaEspresso&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;t5f&quot; size=&quot;2&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;totalPrice7&quot; onFocus=&quot;document.myForm.totalPrice7.blur()&quot; readonly=&quot;true&quot; size=&quot;5&quot;>
</DIV>
</TD>
<TD>
<INPUT type=&quot;button&quot; value=&quot;calculate&quot; onClick=&quot;return calculate7()&quot;>
</TD>
</TR>
<TR>
<TD>Decaffeinated&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$22.95&nbsp;1KG
</TD>
<TD>
<DIV align=&quot;right&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;decaffeinatedBeans&quot; size=&quot;1&quot; value=&quot;0&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;decaffeinatedFilter&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;decaffeinatedPlunger&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textkbox&quot; name=&quot;decaffeinatedEspresso&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;t5g&quot; size=&quot;2&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;totalPrice8&quot; onFocus=&quot;document.myForm.totalPrice8.blur()&quot; readonly=&quot;true&quot; size=&quot;5&quot;>
</DIV>
</TD>
<TD>
<INPUT type=&quot;button&quot; value=&quot;calculate&quot; onClick=&quot;return calculate8()&quot;>
</TD>
</TR>
<TR>
<TD>Organic &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$22.95&nbsp;1KG
</TD>
<TD>
<DIV align=&quot;right&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;organicBeans&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;organicFilter&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textbox&quot; name=&quot;organicPlunger&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;textkbox&quot; name=&quot;organicEspresso&quot; value=&quot;0&quot; size=&quot;1&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;t5h&quot; size=&quot;2&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;totalPrice9&quot; onFocus=&quot;document.myForm.totalPrice9.blur()&quot; readonly=&quot;true&quot; size=&quot;5&quot;>
</DIV>
</TD>
<TD>
<INPUT type=&quot;button&quot; value=&quot;calculate&quot; onClick=&quot;return calculate9()&quot;>
</TD>
</TR>
<TR>
<TH colspan=&quot;5&quot; align=&quot;left&quot;>Maxwell House&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$19.95&nbsp;1KG
</TH>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;maxwellHouse&quot;size=&quot;2&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;totalPrice10&quot; onFocus=&quot;document.myForm.totalPrice10.blur()&quot; readonly=&quot;true&quot; size=&quot;5&quot;>
</DIV>
</TD>
<TD>
<INPUT type=&quot;button&quot; value=&quot;calculate&quot; onClick=&quot;return calculate10()&quot;>
</TD>
<TR>
<TH colspan=&quot;5&quot; align=&quot;left&quot;>Williams Premium $2.95<BR>Blended Tea
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;williamspremiumblendedTea&quot;size=&quot;2&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;totalPrice11&quot; onFocus=&quot;document.myForm.totalPrice11.blur()&quot; readonly=&quot;true&quot; size=&quot;5&quot;>
</DIV>
</TD>
<TD>
<INPUT type=&quot;button&quot; value=&quot;calculate&quot; onClick=&quot;return calculate11()&quot;>
</TD>

</TR>
<TR>
<TH colspan=&quot;5&quot; align=&quot;left&quot;>Milo 1 Kg Refill &nbsp;&nbsp;&nbsp;$11.65&nbsp;1KG<BR>Pack
</TH>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;miLo&quot;size=&quot;2&quot;>
</DIV>
</TD>
<TD>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;text&quot; name=&quot;totalPrice12&quot; onFocus=&quot;document.myForm.totalPrice12.blur()&quot; readonly=&quot;true&quot; size=&quot;5&quot;>
</DIV>
</TD>
<TD>
<INPUT type=&quot;button&quot; value=&quot;calculate&quot; onClick=&quot;return calculate12()&quot;>
</TD>
----------------------------------------------------------
// Help here to remove the answer NaN//

<td>$=</td>
<td><INPUT type=&quot;text&quot; name=&quot;totalValue&quot; onFocus=&quot;document.myForm.totalValue.blur()&quot; readonly=&quot;true&quot;value=&quot;0&quot;size=&quot;5&quot;></td>
<TD>
<INPUT type=&quot;button&quot; value=&quot;calculateTotal&quot; onClick=&quot;return calculateTotal()&quot;>
</TD> </TR>

-----------------------------------------------------------
<TR>
<TD>First Name
</TD>
<TD width=&quot;100&quot;>
<INPUT type=&quot;text&quot; name=&quot;myFirstname&quot;>
</TD>
</TR><BR>
<TR>
<TD>Last Name
</TD>
<TD width=&quot;100&quot;>
<INPUT type=&quot;text&quot; name=&quot;myLastname&quot;>
</TD>
</TR>
<TR>
<TD>E-mail
</TD>
<TD width=&quot;100&quot;>
<INPUT type=&quot;text&quot; name=&quot;myEmail&quot;>
</TD>
</TR>
<TR>
<TD width=&quot;200&quot;>Phone Number
</TD>
<TD>
<INPUT type=&quot;text&quot; name=&quot;myPhone&quot;>
</TD>
</TR>
<TR>
<TR>
<TD>Company Name
</TD>
<TD>
<INPUT type=&quot;text&quot; name=&quot;myCompany&quot;>
</TD>
</TR>
<TD>
</TD>
<TD align=&quot;center&quot;>
</TD>
</TR>
<TR>
<TD align=&quot;left&quot;>
<P><B><BR>Delivery Description:
</B> &nbsp; Free<BR>Freight for orders over $40.00<BR>All other orders $5.00 within the<BR>Auckland area and all other areas.<BR>Please telephone for qoute.<BR>Mr Bean says Thank You
</TD>
<TD width=&quot;100&quot;>
<TEXTAREA name=&quot;comment&quot; rows=&quot;5&quot; col=&quot;165&quot; wrap=&quot;hard&quot;></TEXTAREA>
</TD>
</TR>
</TABLE><BR><BR>
<DIV align=&quot;center&quot;>
<INPUT type=&quot;reset&quot; value=&quot;clear form&quot;>&nbsp;
<INPUT type=&quot;submit&quot; value=&quot;send infomation&quot;>
</FORM>
</DIV>
</BODY>
</HTML>
 
The NaN comes because you are using parseFloat() function and there is no check if the value in the field is a valid number. This seems to be the only possible reason.

Just another suggestion. There seems to be a lot of repeated code in your functions. Instead it is possible to use just one function and pass the Object to the function for calculation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top