Delete one row in html table marqued by a check box with javascript
<p>I build dynamically my HTML table from database
like that:</p>

<pre><code>for (i = 0; i &lt; nomCols.length; i++) {
    retour.append(("&lt;td bgcolor=#0066CC&gt;") + nomCols[i] + "&lt;/td&gt;");

}
retour.append("&lt;/tr&gt;");

retour.append("&lt;tr&gt;");

try {

    s = HibernateUtil.currentSession();
    tx = s.beginTransaction();
    Query query = s.createQuery(HQL_QUERY);

    for (Iterator it = query.iterate(); it.hasNext();) {
        if (it.hasNext()) {
            Dailytimesheet object = (Dailytimesheet) it.next();
            retour.append("&lt;td&gt;&lt;input type=checkbox  name=cb id=cb  /&gt; &lt;/td&gt;");
            retour.append("&lt;td&gt;" + object.getTrackingDate() + "&lt;/td&gt;");
            retour.append("&lt;td&gt;" + object.getActivity() + "&lt;/td&gt;");
            retour.append("&lt;td&gt;" + object.getProjectCode() + "&lt;/td&gt;");
            retour.append("&lt;td&gt;" + object.getWAName() + "&lt;/td&gt;");
            retour.append("&lt;td&gt;" + object.getTaskCode() + "&lt;/td&gt;");
            retour.append("&lt;td&gt;" + object.getTimeSpent() + "&lt;/td&gt;");
            retour.append("&lt;td&gt;" + object.getPercentTaskComplete() + "&lt;/td&gt;");
        }
        retour.append("&lt;/tr&gt;");


    }

    retour.append("&lt;/table&gt;");
    tx.commit();


} catch (HibernateException e) {
    retour.append("&lt;/table&gt;&lt;H1&gt;ERREUR:&lt;/H1&gt;" + e.getMessage());
    e.printStackTrace();
}

return retour;
}
</code></pre>

<p>so I want that all check boxes having the same id.
When trying to delete one row in my table witch have the check box checked i found a problem with that.
Iam using  simple javascript like this:</p>

<pre><code>function DeleteARow() {
    //var Rows = document.getElementById('sheet').getElementsByTagName('tr');
    //var RowsCount = Rows.length;
    //alert('Your table has ' + RowsCount + ' rows.');
    if (document.getElementById('cb').checked == true) {

        document.getElementById('cb').parentNode('td').parentNode('tr').remove();

    }
}
</code></pre>

<p>It doesn't work approperly and only the first row have the id 'cb'.</p>

<p>Many thanks for your help.</p>
