new Option('text', 'value', 'TRUE');
solved it!!!!!
thnx
millw0rm@gmail.com wrote:[color=blue]
> ---------------------
> var select = document.forms.formName.elements.selectName;
> select.options[select.options.length] = new Option('text', 'value');
> ---------------------
>
>
> wow, it worked..
>
> after posting i realised the Cap-Letter 'V' => value.. neways my last
> question.. how do i deal with this????
>
> anOption.selected = true;
>
>
> thnx a lot!!!
>
>
>
>
> Martin Honnen wrote:[color=green]
> >
millw0rm@gmail.com wrote:
> >[color=darkred]
> > > Hi wats wrng with this code??? it works fine on IE6 but not on FireFox
> > > 1.5???
> > >
> > > var anOption = document.createElement("OPTION");
> > > document.getElementById("category").options.add(an Option);[/color]
> >
> > The W3C DOM Level 2 HTML defines an add method for the select element object
> > <http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-94282980>
> > 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=darkred]
> > > anOption.innerText = "NewElement";[/color]
> >
> > Firefox does not support the innerText property at all. For option
> > element objects you can set
> > anOption.text
> >[color=darkred]
> > > anOption.Value = "99";[/color]
> >
> > JavaScript is case sensitive, the property is named value and not Value.
> >
> >
> > --
> >
> > Martin Honnen
> >
http://JavaScript.FAQTs.com/[/color][/color]