The following works fine in Mozilla:
var makeSelect = function (firstOption, lastOption, thisOption,
thisList)
{
var select = document.create Element ("select");
for (var i = firstOption; i <= lastOption; ++i)
{
var option = document.create Element ("option");
option.value = i;
if (thisList)
{
option.appendCh ild (document.creat eTextNode (thisList[i]));
}
else
{
option.appendCh ild (document.creat eTextNode (i));
}
if (i == thisOption)
{
option.selected = 1;
option.style.fo ntWeight = "bold";
}
select.add (option, null);
}
return select;
};
However, IE 6 complains about the select.add statement. The MSDN
documentation on select spouts some sort of blather about using
select.options. add, but that doesn't work either. I notice that IE
defines the add method to take an element and an index rather than two
elements, thus violating the DOM standard.
Any ideas?
var makeSelect = function (firstOption, lastOption, thisOption,
thisList)
{
var select = document.create Element ("select");
for (var i = firstOption; i <= lastOption; ++i)
{
var option = document.create Element ("option");
option.value = i;
if (thisList)
{
option.appendCh ild (document.creat eTextNode (thisList[i]));
}
else
{
option.appendCh ild (document.creat eTextNode (i));
}
if (i == thisOption)
{
option.selected = 1;
option.style.fo ntWeight = "bold";
}
select.add (option, null);
}
return select;
};
However, IE 6 complains about the select.add statement. The MSDN
documentation on select spouts some sort of blather about using
select.options. add, but that doesn't work either. I notice that IE
defines the add method to take an element and an index rather than two
elements, thus violating the DOM standard.
Any ideas?
Comment