How to create a combobox using divs and javascript

Discussion in 'JavaScript' started by +:::Spider25:::+, Sep 8, 2006.

  1. #1
    Hey Guys, see this thread
    http://forums.digitalpoint.com/showthread.php?t=137759

    A friend of mine told me about creating a combobox using JavaScript and div's or something like that, Does anybody about made code for this feature I need?

    Thanks a lot for the answers

    ;)
     
    +:::Spider25:::+, Sep 8, 2006 IP
  2. pushkar

    pushkar Peon

    Messages:
    125
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    HI Spider.

    For the javascript you should go on URL:http://www.hotjavascripts.com.

    best luck.
     
    pushkar, Sep 9, 2006 IP
  3. +:::Spider25:::+

    +:::Spider25:::+ Peon

    Messages:
    69
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    pushkar this site doesn't tell me nothing... I think there was a mistake or misspeling....
     
    +:::Spider25:::+, Sep 9, 2006 IP
  4. +:::Spider25:::+

    +:::Spider25:::+ Peon

    Messages:
    69
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    fck editor
     
    +:::Spider25:::+, Sep 21, 2006 IP
  5. penagate

    penagate Guest

    Messages:
    277
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi!

    A combo box is a select element. Like all elements this can be created through scripting by using DOM functions.

    // Create the element:
    var combo_box = document.createElement('select');
    
    // Set some properties:
    combo_box.name = 'something';
    
    // Add some choices:
    var choice = document.createElement('option');
      choice.value = 'option1';
      choice.appendChild(document.createTextNode('Option 1');
    combo_box.appendChild(choice);
    choice = document.createElement('option');
      choice.value = 'option2';
      choice.appendChild(document.createTextNode('Option 2');
    combo_box.appendChild(choice);
    
    /* Add it to the page.
     Normally you would get a reference to a form element, and add it to that.
     Directly within the body, a select element is meaningless.
    */
    document.body.appendChild(combo_box);
    
    Code (markup):
    Hope that gets you started.
    - P
     
    penagate, Sep 27, 2006 IP