but not for the options collection. However using that method is
difficult as IE implements the method with the same name with different
parameters.
If you simply want to add an option then using the DOM Level 0
var select = document.forms.formName.elements.selectName;
select.options[select.options.length] = new Option('text', 'value');
is much better in terms of browser compatibility.
[color=blue]
> anOption.innerText = "NewElement";[/color]
Firefox does not support the innerText property at all. For option
element objects you can set
anOption.text
[color=blue]
> anOption.Value = "99";[/color]
JavaScript is case sensitive, the property is named value and not Value.
No comments:
Post a Comment