Article View: es.comp.lenguajes.java
Article #660Re: Resetear el valor del texto de Type="file"
From: Paul
Date: Sun, 18 Feb 2007 14:53
Date: Sun, 18 Feb 2007 14:53
48 lines
2520 bytes
2520 bytes
On 18 feb, 13:42, Flint <dirfa...@terra.es> wrote:
> 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
Hola,
Esto que me dices no me funciona si type="file".
Gracias
Technical Details
Message-ID:
<1171810389.588026.290890@q2g2000cwa.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!q2g2000cwa.googlegroups.com!not-for-mailReferences:
<1171800914.372856.123820@v45g2000cwv.googlegroups.com> <53qvtnF1u67mrU1@mid.individual.net>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!postnews.google.com!q2g2000cwa.googlegroups.com!not-for-mail From: "Paul" <gambamia2@yahoo.es> Newsgroups: es.comp.lenguajes.java Subject: Re: Resetear el valor del texto de Type="file" Date: 18 Feb 2007 06:53:09 -0800 Organization: http://groups.google.com Lines: 49 Message-ID: <1171810389.588026.290890@q2g2000cwa.googlegroups.com> References: <1171800914.372856.123820@v45g2000cwv.googlegroups.com> <53qvtnF1u67mrU1@mid.individual.net> NNTP-Posting-Host: 85.50.66.32 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1171810396 985 127.0.0.1 (18 Feb 2007 14:53:16 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 18 Feb 2007 14:53:16 +0000 (UTC) In-Reply-To: <53qvtnF1u67mrU1@mid.individual.net> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: q2g2000cwa.googlegroups.com; posting-host=85.50.66.32; posting-account=sJkUqQ0AAABRTeHFjYlHMV-CoFTNtaDQ