[Javascript] Controling a SELECT from a child window

Peter Brunone peter at brunone.com
Tue Sep 20 23:46:00 CDT 2005


Weird.  Does it say which line?

Also, did you increase the length of the options collection by 1 before adding the new option (in which case the index would be options.length - 1)?

(hopefully this will come through sooner than my *last* message, which was delayed for hours and came through after you answered your own question)

 From: "David Stoltz" Dstoltz at SHH.ORG

 Actually - everything works now except ADDING an option to the select box (on the parent page)...the following fails:     window.opener.document.form1.mylist.options[window.opener.document.form1.mylist.length] = new Option('yourText', 'yourValue');     So does this:     var opt = new Option('text', 'value');
var sel = window.opener.document.form1.mylist;
sel.options[sel.options.length] = opt;
window.opener.document.form1.mylist.options[window.opener.document.form1.mylist.options.length] = opt;     Both give a "Server threw an exception" error...     Any ideas?    Perhaps you cannot add an item to a select box on a parent window? 
 From: javascript-bounces at LaTech.edu On Behalf Of David Stoltz
   I get an error that says "window.opener.document.form1.mylist.option" is null or is not an object      From: javascript-bounces at LaTech.edu On Behalf Of Peter Brunone
  Hi David,

   You should be able to use the same syntax, as long as you refer to it through the window.opener object...

   When someone tells me "it doesn't work", I automatically ask what is really going on.  Are you seeing an error message -- and if so, what does it say -- or is something unexpected happening, or is nothing at all happening?

Cheers,

Peter

 From: "David Stoltz" Dstoltz at SHH.ORG

Hi All,

I have a problem - I am popping up a child window, and I need to:

1) Clear a select box on the parent of all it's options
2) Add new options to the select box on the parent window
3) Select (highlight) an option in the select box on the parent window

Can anyone give me any code how I can do this from the CHILD window? I
am trying with this so far to select an option, with no luck:

window.opener.document.form1.mylist.option[0].selected=true;

Thanks for any help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20050920/7feeed9f/attachment.htm>


More information about the Javascript mailing list