Because the options property of a select is a NodeList, which has similar
properties of an array, in that you can access indices. However, it doesn't
have array methods like "indexOf".



On Fri, Dec 10, 2010 at 10:38 AM, FRamonTB <[email protected]> wrote:

> After doing some probes, this seems to work:
>
>            for (index=0;this.select.options[index].value !=
> value ;index++);
>            this.select.selectedIndex = index;
>
> But this doesn't:
>            index = this.select.options.indexOf(value);
>            this.select.selectedIndex = index;
>
> I don't know why...
>
> Thanks: framontb
>
> On 10 Dec, 18:09, Gafa <[email protected]> wrote:
> > Well, you could always set the html "option" selected in your html
> > when you load your options in.
> >
> > <option value="blah" selected>blah</option><option value="noway">no
> > way</option>
> >
> > Gafa
> >
> > On Dec 10, 11:55 am, FRamonTB <[email protected]> wrote:
> >
> > > Taking advantage of your advices, one more question... (I would like
> > > to get you a beer to feel less guilty, but I suppose you aren't near
> > > my house  :-)
> >
> > > Now I'm selecting the option in the select by means of the
> > > selectedIndex field, like this:
> > > this.select.selectedIndex = selection;
> >
> > > Are there an easy way to select the option by means of the value
> > > stated in the option tag?
> >
> > > Regards: framontb
> >
> > > On 9 Dec, 22:37, Sanford Whiteman <[email protected]> wrote:
> >
> > > > > Yes, I think this was the issue. Now, I'm using the "onSuccess" and
> > > > > the "update" and it works well. I almost can't believe it, I was
> all
> > > > > the day around this. Thanks !!!
> >
> > > > No  prob, do be careful with alert in general and go with
> console.log.
> > > > Alert()  behaves  differently  in  Mozilla-based browsers (or at
> least
> > > > used to) vs.  other engines w/r/t blocking other tasks.  So you may
> be
> > > > altering behavior simply by starting to debug -- never a good thing!
> >
> > > > -- S.
>

Reply via email to