You are here: Re: Get value from popup window to parent window « HTML « IT news, forums, messages
Re: Get value from popup window to parent window

Posted by Jim Davis on 09/06/05 17:51

"Davey" <davey@hello.com> wrote in message news:431da184$1_1@x-privat.org...
>I have a website which has a popup window (this only opens when the user
>chooses to open it). In the popup window I have a <select> control which
>lists a selection of "classes". Each class has a description and a class_id
>(stored in the value attribute of each option). The user will then select a
>class from the drop-down list.
>
> What I want to do is have a control in the parent browser window which can
> store the class_id and the description that the user has selected in the
> popup window.
>
> Any suggestions as to what control I should use in the parent window and
> more importantly how I get the value from the popup window (this must be
> client side code as the user will have entered other values into the form
> in the parent browser window)?

The "opener" property of the popup window is a reference to, well, the
opener. ;^) It links the window which opened the popup.

So you might, to populate a form field in the main window, say (from memory
so I may be a bit off):

window.opener.forms.MainForm.SelectedClass.value = "Whatever they pick";

If you have a variable called "CurrentClass" in the main window you can
populate it from the popup like:

window.opener.CurrentClass = "whuddeva";

"opener" is a top-level element: if your popup or your main caller uses
frames then it might get more complicated (you'd have to chain the reference
out further)... but it's still definitely doable.

Good luck!

Jim Davis

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация