This is more of a javascript question, though my webpage uses php for the output of values in select boxes etc.
Basically I have a webpage that contains a table form, where a user selects a jobcode, a date, enters in a description and enters in how much the expense cost. Then to add another row the user clicks on the 'Add Row' button. The Add row button sets off an onclick() event which calls a javascript function called Add_Row(). Add_Row will copy the elements from the existing row and create a new row.
The function is defined like this:
function Add_Row() {
var oRow;
for (i=0; i < table_grid.rows.length; i++) {
oRow = table_grid.rows(i);
if (oRow.style.display == 'none') {
oRow.style.display = 'inline';
document.all.row_count.value=i;
curr_row=i-1;
CellIndex="R" + curr_row + "C1";
document.all.item(CellIndex).options.remove(document.all.item(CellIndex).options.length-1);
document.all.item(CellIndex).options.selectedIndex=0;
CellIndex="R" + curr_row + "C3";
document.all.item(CellIndex).options.remove(document.all.item(CellIndex).options.length-1);
document.all.item(CellIndex).options.selectedIndex=0;
break;
}
}
return;
}
I am just wondering (as I am not a javascript guru)...how would you be able to add a row to the table with all information of the previous row.
For instance.
Say in the first row I have selected and entered in the following:
Job Code Date Expense Amount
CB0001 21/07/02 Taxi 25.95
say the next day, I also have an expense type of Taxi, how do I in javascript get the contents of the previous row and display it again underneath, whilst also allowing me to edit the contents if I need to?
Anyone's advice would be greatly appreciated!
Thanks