I have the following JavaScript code which is writing in a HTML form:
<script type="text/javascript">
function updatesum() {
document.functie.column8.value = (document.functie.column6.value -0) * (document.functie.column7.value -0);
document.functie.column12.value = (document.functie.column10.value -0) * (document.functie.column11.value -0);
document.functie.column16.value = (document.functie.column14.value -0) * (document.functie.column15.value -0);
document.functie.column20.value = (document.functie.column18.value -0) * (document.functie.column19.value -0);
}
and with the php form like:
echo "<td><input name=\"column6\" onChange=\"updatesum()\"></td>";
echo "<td><input name=\"column7\" onChange=\"updatesum()\"></td>";
The problem is that when I put some values in the first form, it gives me the sum, but if I don't put some values it gives me zero, which I do not want:
http://img17.imageshack.us/img17/5456/hyhu.png http://img17.imageshack.us/img17/5456/hyhu.png
In the bottom I have a sum of all the values from the 3rd column, but the it gives me numbers like 2400 or 2300.44, and I want an output of 2,400 or to roundup the 2300.44 to 2,300. How can I do that?