jeanne
08-08-2002, 08:07 PM
i am creating a scrip to calculate price, totals extra for an order form.
right now the script round to the nearst 100 decimal place.
my problem is that if the total is 56.80
it appears as 56.8
how can i make sure it tacks on that zero when it is needed?
this is my bit of code..
___________________________________________________
// check to make sure quantity and price are both NOT not a number...
if (!isNaN(qnumber) && !isNaN(pnumber))
{
// multiply quanity and price
tnumber = (qnumber * pnumber);
tnumber = Math.round(tnumber * 100) / 100;
tcommand = "document.form.aidtotal"+row+".value = tnumber";
eval(tcommand);
aidsubtotal += tnumber
}
// and make sure they aren't blank
else if ((qvalue != "") && (pvalue != ""))
{
alert("Please enter a number");
}
else
{
tcommand = "document.form.aidtotal"+row+".value = 0";
eval(tcommand);
}
__________________________________________________
does any one have any suggestions?
i feel like the answer is probably simple enough. i just cant seem to wrap my brain around it...
Thanks you in advance for any help you can offer!!
lhenry
lhenry@quinstreet.com
right now the script round to the nearst 100 decimal place.
my problem is that if the total is 56.80
it appears as 56.8
how can i make sure it tacks on that zero when it is needed?
this is my bit of code..
___________________________________________________
// check to make sure quantity and price are both NOT not a number...
if (!isNaN(qnumber) && !isNaN(pnumber))
{
// multiply quanity and price
tnumber = (qnumber * pnumber);
tnumber = Math.round(tnumber * 100) / 100;
tcommand = "document.form.aidtotal"+row+".value = tnumber";
eval(tcommand);
aidsubtotal += tnumber
}
// and make sure they aren't blank
else if ((qvalue != "") && (pvalue != ""))
{
alert("Please enter a number");
}
else
{
tcommand = "document.form.aidtotal"+row+".value = 0";
eval(tcommand);
}
__________________________________________________
does any one have any suggestions?
i feel like the answer is probably simple enough. i just cant seem to wrap my brain around it...
Thanks you in advance for any help you can offer!!
lhenry
lhenry@quinstreet.com