select all elements of one selection list

Discussion in 'Javascript' started by GiSmo, Jul 15, 2003.

  1. GiSmo

    GiSmo Guest

    hello I'm french so I hope I hunderstand your answers ! I'm begginer
    in javascript and I would like to do this :

    select all elements of one selection list (html) with a javascript
    fonction

    could you help me ?

    thanks lot !
    GiSmo, Jul 15, 2003
    #1
    1. Advertising

  2. (GiSmo) writes:

    > hello I'm french so I hope I hunderstand your answers ! I'm begginer
    > in javascript and I would like to do this :
    >
    > select all elements of one selection list (html) with a javascript
    > fonction


    It requres the select element to accept multiple selected options
    (e.g., the tag contains the "multiple" attribute).

    Assume "selectRef" refers to the select element:

    for (var i=0;i<selectRef.options.length;i++) {
    selectRef.options.selected = true;
    }

    That is, set the "selected" field of each option to "true".

    /L
    --
    Lasse Reichstein Nielsen -
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    'Faith without judgement merely degrades the spirit divine.'
    Lasse Reichstein Nielsen, Jul 15, 2003
    #2
    1. Advertising

  3. GiSmo

    GiSmo Guest

    Thx lot it work !

    at a next time
    GiSmo, Jul 16, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Karl Seguin
    Replies:
    3
    Views:
    2,277
    John Morgan
    Feb 10, 2004
  2. J. Hall
    Replies:
    2
    Views:
    1,042
    Jeff Thies
    Apr 21, 2004
  3. Adam Hartshorne
    Replies:
    2
    Views:
    368
    Nitin Motgi
    Jan 27, 2006
  4. curiousity

    HOWTO autopost the selection list upon selection

    curiousity, Nov 21, 2003, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    260
    curiousity
    Nov 21, 2003
  5. Matt
    Replies:
    2
    Views:
    191
    Roland Hall
    Jan 11, 2004
Loading...

Share This Page