Le 16/02/13 22:25, justaguy a �crit :
> We're getting there. Previously your code covers two levels (td and its tr), we need three levels, current TD, its TR, and the TR's parent. With revised code, it solves one problem. I also have dynamically generated TRs and TDs,
> such as
> var newrow = document.createElement("tr");
> var cell = document.createElement("td");
> var cellText = document.createElement('input');
> cellText.type = 'checkbox';
> ... set other attributes
> cell.appendChild(cellText);
> newrow.appendChild(cell);
> cell.onclick = "var row = this.parentNode;
You can't be sure that the parentNode will be a row
> var tdParent = row.parentNode;
That's to say that we expect to get now a TBODY or a TABLE (*)
var trParent = tdParent.parentNode;
We aren't sure we got the right element (the table)
trParent.removeChild(tdParent);"
OK
if we got the good element !
> /* the above line fails;
> I attempted to use cellText.onclick as well, but to no avail
> */
As you make mistakes in nested tags of tables you will not get anything!
> What am I not doing right? Thanks.
The html isn't right !!!
(*) the table containing the row to delete in the example you gave in
one of your previous posts was "nowhere" (it wasn't in a TD).
--
St�phane Moriaux avec/with iMac-intel