Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: About Combobox

  1. #1
    New Coder
    Join Date
    Jan 2004
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    About Combobox

    I would like to acess the unselected options of a combobox, or even write new ones to it.
    The code is like:
    ...
    <select size="1" name="MLFB_Selection">
    <option label="option0" selected="selected">Tom</option>
    <option label="option1">Jack</option>
    <option label="option2">John</option>
    </select></td>
    ...



    and the script part is:
    function refreshMLFB(){
    var File4read, MLFB = new Array(6);
    var ForReading = 1;
    var i = 0;

    MLFBPath = document.CaliForm.MLFBPathFile.value;
    fs = new ActiveXObject("Scripting.FileSystemObject");
    File4read = fs.OpenTextFile(MLFBPath, ForReading, true);

    while(!File4read.AtEndOfStream)
    {
    MLFB[i] = File4read.readline();
    i++;

    }
    document.CaliForm.MLFB_Selection.option0.value = MLFB[0];
    document.CaliForm.MLFB_Selection.option1.value = MLFB[1];

    File4read.close();

    }
    ...

    This function is called somewhere.
    I don't if "document.CaliForm.MLFB_Selection.option0.value = MLFB[0];" is right.

    Thank you in advance.

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    To state new values you need something like

    form_name.option_name.options[index]=new Option(value);

    Take a look at this script at

    http://www.huntingground.freeserve.c...f_opts_pop.htm

    to give you a better idea


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •