Link to home
Start Free TrialLog in
Avatar of kingasa
kingasa

asked on

Dom setAttribute ondblclick & ID for Table row/cell

Hi,

How do I add an onDblClick event for each table TR being created & how do I add an ID for each Cell being created.

function addRow(val1,val2)
{
tabBody = document.getElementsByTagName("TBODY").item(3);
row = document.createElement("TR");
cell1 = document.createElement("TD");
cell2 = document.createElement("TD");
textnode1 = document.createTextNode(val1);
textnode2 = document.createTextNode(val2);
cell1.appendChild(textnode2);
cell2.appendChild(textnode1);
row.appendChild(cell1);
row.appendChild(cell2);
tabBody.appendChild(row);
}

Avatar of a.marsh
a.marsh

row.onclick = function { /* code here */ }

row.id = "id_here";


:o)

Ant
Sorry, make that:

row.onclick = function() { /* code here */ }


Ant
ASKER CERTIFIED SOLUTION
Avatar of a.marsh
a.marsh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial