Accessing HTML Table Cell Data
<p>I need to access to the data of a html cell,but before that ,I need to store the id of my  array (details[i].id) in a cell. I tried with a hidden, but I get an empty cell when I show the table and that's not what I want, what I want is something like the DataKeyNames in ASP.net, that gives us the chance to store the id without necessarily showing it.</p>

<p>This is the code I use to show my array (details) in a html table:</p>

<pre><code>function showTable()
{
    if (details.length&gt;0){
        for (var i=0; i&lt;details.length;i++)
        {
            var tbl = document.getElementById('myTable');

            var newRow = tbl.insertRow(tbl.rows.length);

            var cell1 = newRow.insertCell(0);
            cell1.textAlign='center';
            cell1.innerHTML=details[i].price;

            var cell2 = newRow.insertCell(1);
            cell2.textAlign='center';
            cell2.innerHTML=details[i].description;

            var cell3 = newRow.insertCell(2);
            cell3.textAlign='center';
            cell3.innerHTML='&lt;a href="#"&gt;&lt;img src="images/delete.png" width="14" height="14" alt="Delete" onclick="removeDetail(this)"/&gt;&lt;/a&gt;'

        }



    }
}
</code></pre>

<p>And finally in the <strong>removeDetail</strong> function is where I need to get the cell value, assuming I somehow put the id there.</p>

<pre><code>function removeDetail(r)
{
    var node = r.parentNode;
    while( node &amp;&amp; node.tagName !== 'TR' ) {
        node = node.parentNode;
    }
    var i=node.rowIndex;

    document.getElementById('myTable').deleteRow(i);

    //here's where I need to get the id and, if posible the other values ( price, description) too.



}
</code></pre>

<p>Hope you can help me out.  </p>
