Click to See Complete Forum and Search --> : Calculations on a web page.
jamesgod1979
02-22-2006, 10:06 AM
I know I had the code to do this at one time, but I cant remember how to do it.
Ive got about 5 or 6 entries that I need added for a total at the bottom of the page. Is there a way to do it and where can I find the code for it.
Thanks
James
Needinghelp
02-22-2006, 10:11 AM
What do you mean you have by you have 5 or 6 entries? Do you mean you have 5 or 6 numbers you have to calculate?
JPnyc
02-22-2006, 10:17 AM
That's not enough information. What exactly are you trying to do? Please be as explicit as possible. THanks
Needinghelp
02-22-2006, 10:36 AM
post your code and say what you want done
welsh
02-22-2006, 02:00 PM
u using javascript or a serverside?
jamesgod1979
02-23-2006, 08:37 AM
This is going to be a page used offline for a buisness app. The page is for a wrecker service and they need to add a column of lines dealing with their fees.
Here is what they have. Im just consulting and letting them do it on their own.
Thanks
James
<table border="0" width="100%">
<tr>
<td width="20%"><font face="Arial"><strong>Wrecker
Service</strong></font></td>
<td width="20%"><font face="Garamond">$</font><!--webbot
bot="Validation" s-data-type="Number"
s-number-separators=",." b-value-required="TRUE"
i-minimum-length="1" --><input type="text" size="20"
name="Wrecker" value="0" width="16"></td>
<td width="5%"> </td>
<td width="5%"> </td>
<td width="20%"> </td>
</tr>
<tr>
<td width="20%"><font face="Arial"><strong>Storage</strong></font></td>
<td width="20%"><font face="Garamond">$</font><!--webbot
bot="Validation" s-data-type="Number"
s-number-separators=",." b-value-required="TRUE"
i-minimum-length="1" --><input type="text" size="20"
name="Storage" value="0" width="16"></td>
<td width="5%">($15 X </td>
<td width="5%"><!--webbot bot="Validation"
s-data-type="Number" s-number-separators=",."
b-value-required="TRUE" i-minimum-length="1" --><input
type="text" size="7" name="Days" value="0"></td>
<td width="20%">Days)</td>
</tr>
<tr>
<td width="20%"><font face="Arial"><b>Administrative Fee </b></font></td>
<td width="20%"><font face="Garamond">$</font><!--webbot
bot="Validation" s-data-type="Number"
s-number-separators=",." b-value-required="TRUE"
i-minimum-length="1" --><input type="text" size="20"
name="Admin Fee" value="0" width="16"></td>
<td width="5%"> </td>
<td width="5%"> </td>
<td width="20%"> </td>
</tr>
<tr>
<td width="20%"><font face="Arial"><b>Labor </b></font></td>
<td width="20%"><font face="Garamond">$</font><!--webbot
bot="Validation" s-data-type="Number"
s-number-separators=",." b-value-required="TRUE"
i-minimum-length="1" --><input type="text" size="20"
name="Labor" value="0" width="16"></td>
<td width="5%"> </td>
<td width="5%"> </td>
<td width="20%"> </td>
</tr>
<tr>
<td width="20%"><font face="Arial"><b>Legal Fees </b></font></td>
<td width="20%"><font face="Garamond">$</font><!--webbot
bot="Validation" s-data-type="Number"
s-number-separators=",." b-value-required="TRUE"
i-minimum-length="1" --><input type="text" size="20"
name="Legal Fees" value="0" width="16"></td>
<td width="5%"> </td>
<td width="5%"> </td>
<td width="20%"> </td>
</tr>
<tr>
<td width="20%"><font face="Arial"><b>Total: </b></font></td>
<td width="20%"><font face="Garamond">$</font><!--webbot
bot="Validation" s-data-type="Number"
s-number-separators=",." --><input type="text" size="20"
name="Total" value="0" width="16"></td>
<td width="5%"> </td>
<td width="5%"> </td>
<td width="20%"> </td>
</tr>
</table>
</center></div><div align="center"><center>
</html>
Lerura
02-23-2006, 10:10 AM
change the name's to id's for your input's. eg.:
<input type="text" size="20" id="Total" value="0" width="16">
and use this function like this to calculate:
function Calc(){
Wre=document.getElementById('Wrecker').value*1;
Sto=document.getElementById('Storage').value*1;
Day=document.getElementById('Days').value*1;
Tot=document.getElementById('Total');
Tot.value=Wre+Sto+Day;
}