|
Posted by Davey on 09/06/05 18:47
"Jim Davis" <newsmonkey@vboston.com> wrote in message
news:dfkacg01p6r@news2.newsguy.com...
> "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.
What is the syntax for opening a popup which will allow "opener" to be
accessed from 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";
Yeah this is definitely the sort of thing I'm looking for.
> If you have a variable called "CurrentClass" in the main window you can
> populate it from the popup like:
By "variable" do you mean hidden form control?
> 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.
Excellent thanks.
Navigation:
[Reply to this message]
|