activeComboBox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • carlo

    activeComboBox

    Hello, I have to activate a combo box in a html form to load an array of
    values within the combo. Is there an example somewhere?

    TIA


  • Thomas 'PointedEars' Lahn

    #2
    Re: activeComboBox

    carlo wrote:
    [color=blue]
    > Hello, I have to activate a combo box in a html form to load an array of
    > values within the combo. Is there an example somewhere?[/color]

    There are no combo boxes in HTML. You mean a `select' element of size 1
    which is displayed as a dropdown box in graphical user agents. You can
    focus any form element with its focus() method. Besides, there are
    plenty of postings in the newsgroup that describe how to add options to
    a `select' element (as a Select or HTMLSelectEleme nt object) and how to
    remove them.


    HTH

    PointedEars

    Comment

    • Jeppe 1971

      #3
      Re: activeComboBox

      Hi Carlo

      Don't you think of a <SELECT>-element?

      Here's an example:

      SELECT-element:
      <SELECT ID="idSelect" SIZE="1" onChange="dostu ff(this.value); "></SELECT>

      Adding options:
      function addOptions() {
      var numberOfNewOpti ons = 10;
      var getSelect = document.getEle mentById("idSel ect");
      for (var i = 0; i < numberOfNewOpti ons; i++) {
      var option = new Option("This is option number " + i,i);
      getSelect.optio ns[getSelect.lengt h] = option;
      }
      }

      Removing options:
      function removeOptions() {
      var getSelect = document.getEle mentById("idSel ect");
      while (getSelect.opti ons.length) {
      getSelect.optio ns[0] = null;
      }
      }

      Best regards,

      Jeppe Andersen

      Comment

      Working...