Prueba con esto otro, a ver te parece
Código PHP:
<html>
<head>
<script type="text/javascript">
function adicionarFila(){
var cont = document.getElementById("cont");
var filas = document.getElementById("filas");
cont.setAttribute("value", parseInt(cont.value,0)+1);
filas.setAttribute("value", parseInt(filas.value,0)+1);
var tabla = document.getElementById("contenido").tBodies[0];
var fila = document.createElement("TR");
fila.setAttribute("align","center");
var celda1 = document.createElement("TD");
var codigo1 = document.createElement("INPUT");
codigo1.setAttribute("type","text");
codigo1.setAttribute("size","8");
codigo1.setAttribute("maxlength","20");
codigo1.setAttribute("name","codigo1" + filas.value);
celda1.appendChild(codigo1);
var celda2 = document.createElement("TD");
var codigo2 = document.createElement("INPUT");
codigo2.setAttribute("type","text");
codigo2.setAttribute("size","8");
codigo2.setAttribute("maxlength","20");
codigo2.setAttribute("name","codigo2" + filas.value);
celda2.appendChild(codigo2);
var celda3 = document.createElement("TD");
var codigo3 = document.createElement("INPUT");
codigo3.setAttribute("type","text");
codigo3.setAttribute("size","8");
codigo3.setAttribute("maxlength","20");
codigo3.setAttribute("name","codigo3" + filas.value);
celda3.appendChild(codigo3);
var celda4 = document.createElement("TD");
var codigo4 = document.createElement("INPUT");
codigo4.setAttribute("type","text");
codigo4.setAttribute("size","8");
codigo4.setAttribute("maxlength","20");
codigo4.setAttribute("name","codigo4" + filas.value);
celda4.appendChild(codigo4);
var celda5 = document.createElement("TD");
var codigo5 = document.createElement("INPUT");
codigo5.setAttribute("type","text");
codigo5.setAttribute("size","8");
codigo5.setAttribute("maxlength","20");
codigo5.setAttribute("name","codigo5" + filas.value);
celda5.appendChild(codigo5);
var celda6 = document.createElement("TD");
var codigo6 = document.createElement("INPUT");
codigo6.setAttribute("type","text");
codigo6.setAttribute("size","8");
codigo6.setAttribute("maxlength","20");
codigo6.setAttribute("name","codigo6" + filas.value);
celda6.appendChild(codigo6);
var celda7 = document.createElement("TD");
var codigo7 = document.createElement("INPUT");
codigo7.setAttribute("type","text");
codigo7.setAttribute("size","8");
codigo7.setAttribute("maxlength","20");
codigo7.setAttribute("name","codigo7" + filas.value);
celda7.appendChild(codigo7);
var celda8 = document.createElement("TD");
var codigo8 = document.createElement("INPUT");
codigo8.setAttribute("type","text");
codigo8.setAttribute("size","8");
codigo8.setAttribute("maxlength","20");
codigo8.setAttribute("name","codigo8" + filas.value);
celda8.appendChild(codigo8);
var celda9 = document.createElement('TD');
var boton = document.createElement('INPUT');
boton.setAttribute('type','button');
boton.setAttribute('value','borrar');
boton.onclick=function(){borrarFila(this);}
celda9.appendChild(boton);
fila.appendChild(celda1);
fila.appendChild(celda2);
fila.appendChild(celda3);
fila.appendChild(celda4);
fila.appendChild(celda5);
fila.appendChild(celda6);
fila.appendChild(celda7);
fila.appendChild(celda8);
fila.appendChild(celda9);
tabla.appendChild(fila);
}
function borrarFila(button){
var fila = button.parentNode.parentNode;
var tabla = document.getElementById('contenido').getElementsByTagName('tbody')[0];
tabla.removeChild(fila);
}
</script>
</head>
<body onLoad="adicionarFila()">
<Form name="detalle" action="ej.asp" method="get">
<input name="cont" type="hidden" id="cont" value="0" >
<input name="filas" type="hidden" id="filas" value="0" >
<table align=center width=20% cellpadding=0 cellspacing=0 id="contenido" border="1">
<tr align="center">
<td>Campo1</td>
<td>Campo2</td>
<td>Campo3</td>
<td>Campo4</td>
<td>Campo5</td>
<td>Campo6</td>
<td>Campo7</td>
<td>Campo8</td>
</tr>
</table>
<table align=center width=20% cellpadding=0 cellspacing=0 border="1">
<tr>
<td> </td>
</tr>
<tr align="center">
<td align="CENTER"><input name="enviar" type="submit" id="enviar" value="enviar" onClick="filas.value=cont.value, cont.value=0">
<input name="nueva_fila" type="button" id="nueva_fila" value="nueva fila" onClick="adicionarFila()"></td>
</tr>
</table>
</form>
</body>
</html>
Suerte
P.D Bienvenido
Shiryu_Libra de nuevo, se hechaba de menos tus buenas aportaciones