Re: trying to insert select options with JS at run time.
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: trying to insert select options with JS at run time.

From: Ian Collins <ian-news@hotmail.com>
Date: Sun Apr 09 2006 - 23:05:17 CEST

onetitfemme wrote:
> How come this works
>
> http://www.geocities.com/tekmonk2005/testSelectJS00.html
>
> works fine in Konqueror, but this
>
> http://www.geocities.com/tekmonk2005/testSelectJS02.html
>
> doesn't in FireFox, Internet Explorer and Opera (which apparently
> tries to render two select boxes)?
>
> The only difference is that in the second case the <select ...>
> statement is included in the HTML code, in order to explicitily declare
> the style right in the <select ...> statement (which is what I would
> like to do), where as in the first case the "select" part is also
> string'ed together as part of the options.
>
> I would like to pass to the .innerHTML property the actual option
> values of a form's select box.
>
> How can you do that in a consistent/crossbrowser way?
>
Use DOM methods rather than innerHTML.

Also you should use type="text/javascript" rather than language="JavaScript.

-- 
Ian Collins.
Received on Mon May 1 04:52:15 2006