Hi,
You just need to add your elements to a tbody. For example we have a table like:
<table>
<tbody id="myTable">
<tr>
<td></td> <!-- default cell, is not necesaly you can let the tbody empty-->
</tr>
</tbody>
</table>
<input type="hidden" value="0" id="theValue" /><a href='#' onclick=="javascript:addElement();">Add row</a>
and javascript function to add the element:
<script type="text/javascript">
<!--
function addElement()
{
var ni = document.getElementById('myTable');
var numi = document.getElementById('theValue');
var num = (document.getElementById("theValue").value -1)+ 2;
numi.value = num;
var divIdName = "my"+num+"Table";
var newdiv = document.createElement('tr');
newdiv.setAttribute("id",divIdName);
var newcell1= document.createElement('td');
var newcell2= document.createElement('td');
newcell1.innerHTML = "Content Cell 1 : "
newcell2.innerHTML = "Content Cell2 ";
newdiv.appendChild(newcell1);
newdiv.appendChild(newcell2);
ni.appendChild(newdiv);
}
//-->
</script>
I hope this helps ....
Regards