Modify the 4th column of each row to run a JavaScript using the onBlur event.
Build a JavaScript function tallyRow() that will multiply the Price times the Quantity
as the user executes a mouse-out (onBlur) event
Pass the results of the calculation to the 5th column of each row durring the onBlur event.
Add a calculate button at the bottom of the page for browsers that do not hadle the onBlur event.
The Code
function tallyRow()
{
z=document.orderform.countTtl.value; // hidden value of db recordset count
//alert(z) // use for testing
x=0;y=0;Cost=0;Total=0;ttlQuant=0; // Globals
for (i=1;i<=z;i++) // loop through rows
{ // Use Eval function to dynamically build the column name
x=eval("document.orderform.quantity_"+ i +".value"); // x is quantity
y=eval("document.orderform.price_"+ i +".value"); // y is price
Cost = (x*y); // simple calcualtion
document.getElementById("row_ttl_" + i ).value = Cost.toFixed(2);
} //Pass value of calculation back as 2 decimal value - use __.toFixed(2) function
}
. . . H T M L . . .