
01/10/2010, 14:25
|
 | | | Fecha de Ingreso: septiembre-2010
Mensajes: 31
Antigüedad: 14 años, 4 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> |