aquí dejo el ejemplo sobre el que trabajo
Código HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <meta name="Author" content="derkeNuke"> <script type="text/javascript"> function CrearInput(tabla1){ var tabla = document.getElementById(tabla1); var camp = document.getElementById('i_evento').value; var camp2 = document.getElementById('i_lugar').value; var camp3 = document.getElementById('i_hora').value; var camp4 = document.getElementById('i_fecha').value; var filas = tabla.rows.length; var objRow = tabla.insertRow(filas); var objCell; objCell = objRow.insertCell(0); objCell.innerHTML = "<input type='button' name='Submit' value='x' onclick='borrar(this);'/>"; objCell = objRow.insertCell(0); objCell.innerHTML = '<input name="fecha[]" maxlength="10" type="text" id="fecha[]" value="'+ camp4 +'" size="10" readonly/>'; objCell = objRow.insertCell(0); objCell.innerHTML = '<input name="hora[]" maxlength="20" type="text" id="hora[]" value="'+ camp3 +'" size="10" readonly/>'; objCell = objRow.insertCell(0); objCell.innerHTML = '<input name="lugar[]" maxlength="50" type="text" id="lugar[]" value="'+ camp2 +'" size="40" readonly/>'; objCell = objRow.insertCell(0); objCell.innerHTML = '<input name="evento[]" maxlength="50" type="text" id="evento[]" value="'+ camp +'" size="40" readonly/>'; } function borrar(objeto){ var nodo_del_row = objeto.parentNode.parentNode; var index_del_row = nodo_del_row.rowIndex; var nodo_de_tabla = nodo_del_row.parentNode; x=objeto.parentNode.parentNode.parentNode; x.deleteRow(index_del_row); } </script> </head> <body> <script> window.onload = function() { document.onclick = function() { CrearInput("miTabla"); } } </script> <FORM action="DOMVAL.php" method='post' > <table width="435" border="0" align="center" class="BORDE_TABLAS" id="tb_fechas"> <tr> <td> <input name="i_evento" maxlength="50" type="text" id="i_evento" size="45"/> </td> <td> <input name="i_lugar" maxlength="50" type="text" id="i_lugar" size="40"/></td> <td> <input name="i_hora" maxlength="20" type="text" id="i_hora" size="10"/></td> <td> <input name="i_fecha" maxlength="10" type="text" id="i_fecha" size="10"/></td> </tr> <tr> <td colspan="4"><div align="right"><span class="Estilo22">[Añadir nueva fila]</span> <input type="button" name="Submit3" value="+" onclick="javascript:CrearInput('tb_fechas');"/> </div></td> </tr> <tr> <td width="140" bgcolor="#ff0066"><div align="center"><strong><span class="Estilo26">COLUMNA 1</span></strong></div></td> <td width="126" bgcolor="#ff0066"><div align="center"><strong><span class="Estilo26">COLUMNA 2</span></strong></div></td> <td width="126" bgcolor="#ff0066"><div align="center"><strong><span class="Estilo26">COLUMNA 3</span></strong></div></td> <td width="126" bgcolor="#ff0066"><div align="center"><strong><span class="Estilo26">COLUMNA 4</span></strong></div></td> <td width="23" bgcolor="#ff0066"><div align="center"></div></td> </tr> </table> <input type="submit" name="validar" value="confirmar" > </form> </body> </html>
gracias