[thelist] [DOM] Dynamically adding an OPTION to SELECT - funky IE vs Gecko...

Kasimir K mail at kasimir-k.fi
Tue Mar 16 08:02:43 CST 2004


>>you may also want to use:
>>option.appendChild(document.createTextNode(arrayOptions[1][i]));
>
> This of course also works. However, this is only the TEXT value of
> the option. Is there a DOM way to append the VALUE? 

check out 
http://www.w3.org/TR/2002/CR-DOM-Level-2-HTML-20021007/html.html#ID-70901257 


so you can just:
option.value = arrayOptions[0][i];
as you did before.

however, you can not:
option.text = arrayOptions[1][i];
because 'text' is readonly attribute ('form' and 'inxed' are readonly too).



.kasimir


More information about the thelist mailing list