🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.lenguajes.java
Article #659

Re: Resetear el valor del texto de Type="file"

#659
From: Flint
Date: Sun, 18 Feb 2007 12:42
37 lines
1820 bytes
Paul escribi�:
> Hola,
> 
> Tengo en HTML un formulario y dentro de este tengo:
> <input name="txtImg1" type="file" size="50" maxlength="100">, dode se
> selecciona el path de una imagen.
> 
> Pero llega un momento que desear�a inicializar el contenido del texto
> y limpiar su contenido, es decir, dejarlo vac�o.
> 
> Alguna idea?
> 
> Gracias
> 

Con javascript.

O bien recorres el formulario o, m�s f�cil, le a�ades un atributo id as�:

	<input name="txtImg1" id="txtImg1" type="file" size="50" maxlength="100">

De esa manera, donde te interese le a�ades el evento que dispara la 
funci�n javascript. Supongamos un bot�n que al pulsarlo limpie el contenido:

<input type ="button" onclick="limpiar()" value="Limpiar"/>

Y la funci�n javascript ser�a tal que:

<script type="text/javascript">
	function limpiar(){
		document.getElementById('txtImg1').value ='';
	}
</script>

-- 
Un saludo, Flint
Gijon Fortuna (773926) www.fibha.com
Technical Details
Message-ID: <53qvtnF1u67mrU1@mid.individual.net>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <1171800914.372856.123820@v45g2000cwv.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1116f3,488dfd7adce2523f
X-Google-Attributes: gid1116f3,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Flint <dirfalsa@terra.es>
Newsgroups: es.comp.lenguajes.java
Subject: Re: Resetear el valor del texto de Type="file"
Date: Sun, 18 Feb 2007 13:42:31 +0100
Lines: 37
Message-ID: <53qvtnF1u67mrU1@mid.individual.net>
References: <1171800914.372856.123820@v45g2000cwv.googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net JuhvLHSJGnOZdAZptc10RwavM7rNSnu889GGkIZLyFflCl7wHE
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
In-Reply-To: <1171800914.372856.123820@v45g2000cwv.googlegroups.com>