Article View: chile.comp.programacion
Article #53Re: JavaScript - Consulta: Select.options[i].selected = true no me funciona
From: hsalgado
Date: Tue, 25 Apr 2006 03:11
Date: Tue, 25 Apr 2006 03:11
27 lines
1810 bytes
1810 bytes
In chile.comp.www Prometeo <promodeus@gmail.com> wrote:
> function SelVal(aMenu,aValue)
> {
> var tot = aMenu.options.length; var i = 0; exito = false;
> while ( (i<tot) && (!exito) )
> {
> if (aMenu.options[i].value == aValue)
> {
> aMenu.options.selectedIndex=i;
> exito=true;
> }
> i++;
> }
> }
> No obstante, pese a funcionar en mi cabeza, y no generar errores, y
> t?cnicamente funcionar.... no cambia la opci?n seleccionada.... sigue
> la lista seleccionada en la opci?n 0.
la propiedad "selectedIndex" es de select, no de los options.
la propiedad que debes usar en los options es "selected", dandole
un valor "true".
hugo
Technical Details
Message-ID:
<e2k41v$3pt$1@helcaraxe.dcc.uchile.cl>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!opentransit.net!newsfeed.yul.equant.net!news-santiago!helcaraxe.dcc.uchile.cl!not-for-mailReferences:
<1145912758.029274.68010@i40g2000cwc.googlegroups.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,c0aa30127184ed50
X-Google-Thread: 107d6b,c0aa30127184ed50
X-Google-Thread: fad43,c0aa30127184ed50
X-Google-Attributes: gid1593cb,gid107d6b,gidfad43,public
X-Google-Language: SPANISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!opentransit.net!newsfeed.yul.equant.net!news-santiago!helcaraxe.dcc.uchile.cl!not-for-mail
From: hsalgado@dcc.uchile.cl
Newsgroups: chile.comp.programacion,chile.comp.misc,chile.comp.www
Subject: Re: JavaScript - Consulta: Select.options[i].selected = true no me funciona
Date: Tue, 25 Apr 2006 03:11:59 +0000 (UTC)
Organization: DCC - Universidad de Chile
Lines: 28
Message-ID: <e2k41v$3pt$1@helcaraxe.dcc.uchile.cl>
References: <1145912758.029274.68010@i40g2000cwc.googlegroups.com>
NNTP-Posting-Host: anakena.dcc.uchile.cl
X-Trace: helcaraxe.dcc.uchile.cl 1145934719 3901 192.80.24.6 (25 Apr 2006 03:11:59 GMT)
X-Complaints-To: newsmaster@dcc.uchile.cl
NNTP-Posting-Date: Tue, 25 Apr 2006 03:11:59 +0000 (UTC)
User-Agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (Linux/2.6.14-gentoo-r5 (i686))