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.getElementsByTagN ame("TBODY ").item(3) ;
row = document.createElement("TR ");
cell1 = document.createElement("TD ");
cell2 = document.createElement("TD ");
textnode1 = document.createTextNode(va l1);
textnode2 = document.createTextNode(va l2);
cell1.appendChild(textnode 2);
cell2.appendChild(textnode 1);
row.appendChild(cell1);
row.appendChild(cell2);
tabBody.appendChild(row);
}
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.getElementsByTagN
row = document.createElement("TR
cell1 = document.createElement("TD
cell2 = document.createElement("TD
textnode1 = document.createTextNode(va
textnode2 = document.createTextNode(va
cell1.appendChild(textnode
cell2.appendChild(textnode
row.appendChild(cell1);
row.appendChild(cell2);
tabBody.appendChild(row);
}
Sorry, make that:
row.onclick = function() { /* code here */ }
Ant
row.onclick = function() { /* code here */ }
Ant
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
row.id = "id_here";
:o)
Ant