Ver Mensaje Individual
  #14 (permalink)  
Antiguo 01/10/2010, 14:25
Avatar de dayanirojas
dayanirojas
 
Fecha de Ingreso: septiembre-2010
Mensajes: 31
Antigüedad: 13 años, 7 meses
Puntos: 0
Respuesta: campos dinamicos

a ok mira les cambie el nombre a todos
<script type="text/javascript">
<!--
num=0;
function crear(obj) {
num++;
fi = document.getElementById('fiel');
contenedor = document.createElement('div');
contenedor.id = 'div'+num;
fi.appendChild(contenedor);

ele = document.createElement('input');
ele.type = 'text';
ele.name = 'nombre[]';
contenedor.appendChild(ele);
ele = document.createElement('input');
ele.type = 'text';
ele.name = 'tipo[]';
contenedor.appendChild(ele);
ele = document.createElement('input');
ele.type = 'text';
ele.name = 'directorio_i[]';
contenedor.appendChild(ele);
ele = document.createElement('input');
ele.type = 'text';
ele.name = 'directorio_f[]';
contenedor.appendChild(ele);
ele = document.createElement('input');
ele.type = 'text';
ele.name = 'ruta_i[]';
contenedor.appendChild(ele);
ele = document.createElement('input');
ele.type = 'text';
ele.name = 'rita_f[]';
contenedor.appendChild(ele);

ele = document.createElement('input');
ele.type = 'button';
ele.value = 'Borrar';
ele.name = 'div'+num;
ele.onclick = function () {borrar(this.name)}
contenedor.appendChild(ele);
}
function borrar(obj) {
fi = document.getElementById('fiel');
fi.removeChild(document.getElementById(obj));
}
function enviar(){
document.form1.submit();
}

</script>