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.
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;
}
}
Comment