...

View Full Version : About Combobox



wind0965
01-14-2004, 04:00 PM
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.

Mr J
01-15-2004, 04:32 PM
To state new values you need something like

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

Take a look at this script at

www.huntingground.freeserve.co.uk/scripts/f_opts_pop.htm

to give you a better idea



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum