
Anyway, I need a help.
I have made a table form for inputing and inside the table I made another table which the function is for user can add the components.
(might be you can see the image what is the result, I uploaded one)
I use this script to add rows with javascript:
- Code: Select all
function addRowToTable()
{
var tbl = document.getElementById('table2');
var lastRow = tbl.rows.length;
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
// left cell
var cellLeft = row.insertCell(0);
var textNode = document.createTextNode(iteration);
cellLeft.appendChild(textNode);
// right cell
var cellRightSel1 = row.insertCell(1);
var sel = document.createElement('select');
sel.name = 'component' + iteration;
cellRightSel1.appendChild(sel);
// select cell
var cellRightSel2 = row.insertCell(2);
var sel = document.createElement('select');
sel.id = 'subcomponent' + iteration;
sel.options[0] = new Option('','');
sel.options[1] = new Option('#', '');
cellRightSel2.appendChild(sel);
var cellRight = row.insertCell(3);
var el = document.createElement('input');
el.type = 'text';
el.name = 'point' + iteration;
el.readonly = 'point';
el.size = '2';
//el.onkeypress = keyPressTest;
cellRight.appendChild(el);
}
Then.. when I click the add button at the act number one, row number two is show up and yeah it is working BUT.. no options in the Name and Sub Name column. I mean, I cannot select because there is no data.
(see the image, two.jpg)
With the script in the function add row, how to call data from database? I want the number two look same like number one.
Thanks in Advance.

