ik weet alleen niet hoe ik in de onclick waarde meegeef welke rij het betreft.
het gaat dus om de function removeThisRowFromTable
en de actie van de knop wordt in // delrow cell gemaakt door:
el.setAttribute ("onClick","removeThisRowFromTable(3)");
waar 3 dus het nummer van de cel moet worden
// Last updated 2006-02-21
function addRowToTable()
{
var tbl = document.getElementById('tblSample');
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);
// 1e cel
var cellRight = row.insertCell(0);
var el = document.createElement('input');
el.type = 'text';
el.name = 'txtRow' + iteration;
el.id = 'txtRow' + iteration;
el.size = 40;
el.onkeypress = keyPressTest;
cellRight.appendChild(el);
// 2e cel
var cellRightSel = row.insertCell(1);
var sel = document.createElement('select');
sel.name = 'selRow' + iteration;
sel.options[0] = new Option('text zero', 'value0');
sel.options[1] = new Option('text one', 'value1');
cellRightSel.appendChild(sel);
// delrow cell
var cellRight = row.insertCell(2);
var el = document.createElement('input');
el.type = 'button';
el.name = 'delRow' + iteration;
el.id = 'delRow' + iteration;
el.value = 'X';
el.setAttribute ("onClick","removeThisRowFromTable(3)");
cellRight.appendChild(el);
}
function removeThisRowFromTable(thisRow)
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
if (lastRow > 2) tbl.deleteRow(thisRow);
}