Article View: es.comp.lenguajes.java
Article #663Re: Resetear el valor del texto de Type="file"
From: Paul
Date: Sun, 18 Feb 2007 15:47
Date: Sun, 18 Feb 2007 15:47
53 lines
2905 bytes
2905 bytes
On 18 feb, 16:19, Flint <dirfa...@terra.es> wrote:
> Paul escribió:
>
>
>
> > Hola,
>
> > Esto que me dices no me funciona si type="file".
>
> > Gracias
>
> Tienes toda la razón. No se puede hacer por motivos de seguridad (se me
> había pasado el type="file" :-P
>
> Así que la solución pasaría por cargarse el input entero y volver a
> crearlo nuevo. La manera más sencilla de hacerlo es metiendo el input en
> un div y jugar con el innerHTML, tal que así (no necesitas ya el id del
> input, sino que lo pondremos en el div):
> <div id="txtImg1">
> <input name="txtImg1" type="file" size="50" maxlength="100">
> </div>
>
> El botón, o lo que sea que limpie, seguirá llamando a la función:
>
> <input type ="button" onclick="limpiar()" value="Limpiar"/>
>
> Y la función quedaría así:
>
> <script type="text/javascript">
> function limpiar(){
> txtImg1.innerHTML='';
> txtImg1.innerHTML='<input name="txtImg1" type="file" size="50"
> maxlength="100">';
> }
> </script>
>
> Y ya.
>
> --
> Un saludo, Flint
> Gijon Fortuna (773926)www.fibha.com
Muchas gracias, ya me ha funcionado, pero hay alguna forma de evitar
volver a escribir lo de
txtImg1.innerHTML='<input name="txtImg1" type="file" size="50"
maxlength="100">';
Es decir puedo ller esta cadena de algún sitio y luego volver a
asignarla?
Gracias
Technical Details
Message-ID:
<1171813679.709496.231400@v45g2000cwv.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!postnews.google.com!v45g2000cwv.googlegroups.com!not-for-mailReferences:
<1171800914.372856.123820@v45g2000cwv.googlegroups.com> <53qvtnF1u67mrU1@mid.individual.net> <1171810389.588026.290890@q2g2000cwa.googlegroups.com> <53r94hF1tq4p5U1@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!v45g2000cwv.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 07:47:59 -0800 Organization: http://groups.google.com Lines: 54 Message-ID: <1171813679.709496.231400@v45g2000cwv.googlegroups.com> References: <1171800914.372856.123820@v45g2000cwv.googlegroups.com> <53qvtnF1u67mrU1@mid.individual.net> <1171810389.588026.290890@q2g2000cwa.googlegroups.com> <53r94hF1tq4p5U1@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 1171813686 9274 127.0.0.1 (18 Feb 2007 15:48:06 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 18 Feb 2007 15:48:06 +0000 (UTC) In-Reply-To: <53r94hF1tq4p5U1@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: v45g2000cwv.googlegroups.com; posting-host=85.50.66.32; posting-account=sJkUqQ0AAABRTeHFjYlHMV-CoFTNtaDQ