Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #16156 > unrolled thread

Who's eaten my apple and why?

Started byjustaguy <lichunshen84@gmail.com>
First post2012-09-26 14:43 -0700
Last post2012-09-26 17:50 -0700
Articles 2 on this page of 22 — 7 participants

Back to article view | Back to comp.lang.javascript


Contents

  Who's eaten my apple and why? justaguy <lichunshen84@gmail.com> - 2012-09-26 14:43 -0700
    Re: Who's eaten my apple and why? Christoph Becker <cmbecker69@gmx.de> - 2012-09-27 01:35 +0200
      Re: Who's eaten my apple and why? justaguy <lichunshen84@gmail.com> - 2012-09-26 17:46 -0700
        Re: Who's eaten my apple and why? Stefan Weiss <krewecherl@gmail.com> - 2012-09-27 03:51 +0200
          Re: Who's eaten my apple and why? justaguy <lichunshen84@gmail.com> - 2012-09-26 19:44 -0700
            Re: Who's eaten my apple and why? Stefan Weiss <krewecherl@gmail.com> - 2012-09-27 22:06 +0200
      Re: Who's eaten my apple and why? Gene Wirchenko <genew@ocis.net> - 2012-09-26 17:59 -0700
        Re: Who's eaten my apple and why? Stefan Weiss <krewecherl@gmail.com> - 2012-09-27 04:16 +0200
          Re: Who's eaten my apple and why? Gene Wirchenko <genew@ocis.net> - 2012-09-26 19:38 -0700
            Re: Who's eaten my apple and why? Stefan Weiss <krewecherl@gmail.com> - 2012-09-27 05:44 +0200
              Re: Who's eaten my apple and why? Gene Wirchenko <genew@ocis.net> - 2012-09-27 09:28 -0700
                Re: Who's eaten my apple and why? Tim Streater <timstreater@greenbee.net> - 2012-09-27 17:40 +0100
                  Re: Who's eaten my apple and why? Gene Wirchenko <genew@ocis.net> - 2012-09-27 16:24 -0700
                Re: Who's eaten my apple and why? Dr J R Stockton <reply1239@merlyn.demon.co.uk.invalid> - 2012-09-29 20:47 +0100
            Re: Who's eaten my apple and why? Christoph Becker <cmbecker69@gmx.de> - 2012-09-27 13:00 +0200
              Re: Who's eaten my apple and why? Gene Wirchenko <genew@ocis.net> - 2012-09-27 09:34 -0700
                Re: Who's eaten my apple and why? Christoph Becker <cmbecker69@gmx.de> - 2012-09-27 19:14 +0200
                  Re: Who's eaten my apple and why? Stefan Weiss <krewecherl@gmail.com> - 2012-09-27 21:40 +0200
                    Re: Who's eaten my apple and why? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-28 15:39 +0200
                  Re: Who's eaten my apple and why? Gene Wirchenko <genew@ocis.net> - 2012-09-27 16:25 -0700
        Re: Who's eaten my apple and why? Tim Streater <timstreater@greenbee.net> - 2012-09-27 08:52 +0100
    Re: Who's eaten my apple and why? Gene Wirchenko <genew@ocis.net> - 2012-09-26 17:50 -0700

Page 2 of 2 — ← Prev page 1 [2]


#16174

FromTim Streater <timstreater@greenbee.net>
Date2012-09-27 08:52 +0100
Message-ID<timstreater-864F9A.08522227092012@news.individual.net>
In reply to#16164
In article <f097689vq8t2i4d344qhsse20dg9jephgj@4ax.com>,
 Gene Wirchenko <genew@ocis.net> wrote:

> On Thu, 27 Sep 2012 01:35:17 +0200, Christoph Becker
> <cmbecker69@gmx.de> wrote:

> > 	function dSelect() {
> > 		var sel = document.getElementById('mySel');
> > 		var o = document.createElement('option');
> > 		o.value="a";
> > 		o.text="apple";
> > 		sel.options.add(o);
> > 		alert(sel.length);
> >
> > 		o = document.createElement('option');
> > 		o.value="ora";
> > 		o.text="orange";
> > 		sel.options.add(o);
> > 		alert(sel.length);
> > 	}
> 
>      Yes, this works, but I do not understand why a second element
> needs to be created.

For the same reason that you don't do:

<select>
<option value="1,2,3,4">apples,oranges,pears,peaches</option>
</select>

If you want four options, you need to create four options.

-- 
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

[toc] | [prev] | [next] | [standalone]


#16163

FromGene Wirchenko <genew@ocis.net>
Date2012-09-26 17:50 -0700
Message-ID<bi8768pkn5bn17p4c7vjng21tek43r4vmf@4ax.com>
In reply to#16156
On Wed, 26 Sep 2012 14:43:48 -0700 (PDT), justaguy
<lichunshen84@gmail.com> wrote:

[snip]

><body>
><form>
>select:
><select id="mySel" name="mySel">
><option value="">

     In addition to what Christoph posted, you should put a </option>
tag here.  Or just leave out the <option> tag; you do not have to have
one.  It just gives you a blank selection (which you may or may not
want).

></select>
><br/>
><input type="button" value="populate the select box"
>onclick="dSelect();">
></form>
></body>
></html>

Sincerely,

Gene Wirchenko

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.javascript


csiph-web