Repost of:[Javascript] Adding an item to a select list from anotherwindow

David Lovering dlovering at gazos.com
Thu Sep 25 10:55:45 CDT 2003


I think you are getting bitten by the comma-delimited list here.  You can't
stuff that into a single option.

You are much better off by running a 'for loop' around the array generated
by splitting the comma delimeted list, and doing each entry by itself with
the new Object declaration.

That should work ok -- I do it all the time.

-- Dave Lovering

----- Original Message ----- 
From: "Robert Pollard" <rpollard at apple.com>
To: <javascript at LaTech.edu>
Sent: Thursday, September 25, 2003 8:44 AM
Subject: Repost of:[Javascript] Adding an item to a select list from
anotherwindow


> I'm sorry I posted this with the typo.  I had to change the code after
> I copied into the email and didn't notice I replaced the text
> incorrectly.
> My code doesn't have 2 options[j] in it.  I just posted it incorrectly
> to the list.
>
> I apologize for wasting your time with a typo.
>
> Here is the code as it is in my source:
>
> 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] =
> 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