
05/11/2008, 08:38
|
| | Fecha de Ingreso: septiembre-2008 Ubicación: Estado de México
Mensajes: 84
Antigüedad: 16 años, 5 meses Puntos: 1 | |
Respuesta: Componentes Hola David, de hehco ya lo realize pongo el codigo por si alguien lo llegara a necesitar, de antemano muchas gracias:
<HTML>
<HEAD>
<script type="text/javascript">
var numero = 0;
evento = function (evt) {
return (!evt) ? event : evt;
}
addCampo = function () {
nDiv = document.createElement('div');
nDiv.className = 'archivo';
nDiv.id = 'file' + (++numero);
nCampo = document.createElement('input');
nCampo.name = 'archivos[]';
nCampo.type = 'file';
a = document.createElement('a');
a.name = nDiv.id;
a.href = '#';
a.onclick = elimCamp;
a.innerHTML = 'Eliminar';
nDiv.appendChild(nCampo);
nDiv.appendChild(a);
container = document.getElementById('adjuntos');
container.appendChild(nDiv);
}
elimCamp = function (evt){
evt = evento(evt);
nCampo = rObj(evt);
div = document.getElementById(nCampo.name);
div.parentNode.removeChild(div);
}
rObj = function (evt) {
return evt.srcElement ? evt.srcElement : evt.target;
}
</script>
</HEAD>
<BODY>
<form name="formu" id="formu" action="subir.php" method="post" enctype="multipart/form-data">
<dl>
<dt><label>Archivos a Subir:</label></dt>
<!-- Esta div contendrá todos los campos file que creemos -->
<dd><div id="adjuntos">
<input type="file" name="archivos[]" /><br />
</div></dd>
<dt><a href="#" onClick="addCampo()">Agregar otro archivo</a></dt>
<dd><input type="submit" value="Enviar" id="envia" name="envia" /></dd>
</dl></form>
</BODY>
</HTML>
Cabe mecionar que es reingenieria.
Saludos |