[Javascript] Adding an item to a select list from another window

David Lovering dlovering at gazos.com
Wed Sep 24 21:55:03 CDT 2003


If I had to guess, I'd say the thing was dying at the
options[...].options[...].  I can't find any analog in W3C, IE, or the
Netscape/Mozilla definitions that can handle this.

If you want to set a second selection based upon the values defined in the
first, you are better off evaluating the text/value for the selectedIndex of
the first menu, and then write it into the second.

Cascaded menus are a whole other ball-game, and the structures are quite
different from what you describe here.

-- Dave Lovering

----- Original Message ----- 
From: "Robert Pollard" <rpollard at apple.com>
To: <javascript at LaTech.edu>
Sent: Wednesday, September 24, 2003 7:39 PM
Subject: [Javascript] Adding an item to a select list from another window


> Hello all,
>
> I hope this is not too much of challenge but I have been having bad
> luck with it.
>
> I am executing this code from another window.  I have a lot of code
> that updates fields in the opening window from the opened window.  All
> my code works except this:
>
> var vFields = new Option(commaDelimitedList, "",false,false);
> var j = window.opener.document.forms[0].elements[aValue[i]].length;
>
> It's good up until here.  This next line causes Explorer to
> unexpectedly quit.
>
> window.opener.document.forms[0].elements[aValue[i]].options[j].options[j
> ] = vFields;
> This next line just returns a no object error.
> window.opener.document.forms[0].elements[aValue[i]].options[j].value =
> commaDelimitedList;
>
> Platform is Mac OS X 10.2.3
> Explorer: 5.2
>
> Any ideas why this wouldn't work?  Notice the second line actually
> returns a value.
>
> Thanks for any insight,
>
> Robert Pollard
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>





More information about the Javascript mailing list