I
Idelso Quintero
Hi everyone:
Could someone look into what could possibly be wrong in these lines of
code? It looks all good to me but for some reason the combo box that
is created, is not shown with all the properties (attributes) set.
Actually the message box (alert) that is used to review the content of
the SELECT statement, shows that the only attributes set are size = 1
and id = theComboBox. The other two statements, refering to name and
style, are completely ignored, actually never placed as attributes of
the SELECT node. As a result the combo is shown with a defaulted font
size different than the rest of the components in my form.
Any idea?
Thanks a lot
Here is a snipset of the code:
function AddCombo(Names, Values)
{
var ComboBox;
var optionVal;
var i;
var count = Names.length;
ComboBox =document.createElement('SELECT');
optionVal = new Option(Names[0],Values[0],true,true);
ComboBox.options[ComboBox.options.length] = optionVal; //position 0
for (i=1; i < count; i++)
{
optionVal = new Option(Names,Values,false,false);
ComboBox.options[ComboBox.options.length] = optionVal;
}
ComboBox.setAttribute('size','1');
ComboBox.setAttribute('style','font-size:9pt');
ComboBox.setAttribute('name','theComboBox');
ComboBox.setAttribute('id','theComboBox');
alert (ComboBox.outerHTML);
//---- CODE TO PLACE THE COMBO IN THE FORM -----
......
}
Could someone look into what could possibly be wrong in these lines of
code? It looks all good to me but for some reason the combo box that
is created, is not shown with all the properties (attributes) set.
Actually the message box (alert) that is used to review the content of
the SELECT statement, shows that the only attributes set are size = 1
and id = theComboBox. The other two statements, refering to name and
style, are completely ignored, actually never placed as attributes of
the SELECT node. As a result the combo is shown with a defaulted font
size different than the rest of the components in my form.
Any idea?
Thanks a lot
Here is a snipset of the code:
function AddCombo(Names, Values)
{
var ComboBox;
var optionVal;
var i;
var count = Names.length;
ComboBox =document.createElement('SELECT');
optionVal = new Option(Names[0],Values[0],true,true);
ComboBox.options[ComboBox.options.length] = optionVal; //position 0
for (i=1; i < count; i++)
{
optionVal = new Option(Names,Values,false,false);
ComboBox.options[ComboBox.options.length] = optionVal;
}
ComboBox.setAttribute('size','1');
ComboBox.setAttribute('style','font-size:9pt');
ComboBox.setAttribute('name','theComboBox');
ComboBox.setAttribute('id','theComboBox');
alert (ComboBox.outerHTML);
//---- CODE TO PLACE THE COMBO IN THE FORM -----
......
}