Hola
7th_Sign
Me he entretenido un rato haciendo este código, espero que te sirva:
Código PHP:
<html>
<head>
<script type="text/javascript">
function anadir(obj) {
fila = obj.parentNode.parentNode;
tabla = fila.parentNode;
lineas = tabla.getElementsByTagName('tr');
// averiguar fila pulsada
for (i=0; ele = lineas[i]; i++)
if (ele==fila) break;
// crear fila, celdas y botón
f = document.createElement('tr');
c = f.appendChild(document.createElement('td'));
c.innerHTML = '---';
c = f.appendChild(document.createElement('td'));
b = document.createElement('input');
b.setAttribute('type','button');
b.onclick = function() {anadir(this)}
c.appendChild(b);
if (i==lineas.length-1)
tabla.appendChild(f);
else
tabla.insertBefore(f,lineas[i+1]);
}
</script>
</head>
<body>
<table>
<tbody>
<tr><td>-1-</td><td><input type="button" onclick="anadir(this)" /></td></tr>
<tr><td>-2-</td><td><input type="button" onclick="anadir(this)" /></td></tr>
<tr><td>-3-</td><td><input type="button" onclick="anadir(this)" /></td></tr>
</tbody>
</table>
</body>
</html>
Saludos,