PDA

View Full Version : referencing elements in a different window


sbaral
03-16-2004, 01:11 AM
Hi,

I want to reference elements of a another window using JavaScript. Is there a way to do it? I have a data entry form on one window and a pick list in a different window. When the user clicks on an item in the picklist I want to transfer the selected value to a text field in the data entry window. This seems like such a simple thing to do but I haven't found a way to do it. Any suggestions will be very helpful. Thank you!

steurm
03-17-2004, 01:31 AM
I know you can do it when there is a relation between the 2 windows, for instance if you open a new window, then you can communicate between those 2 (if there is no relation, you are blocked by securityrules of the DOM I think). If win1 is the original, wich opens win2, then in win2 you can reference the elements of win1 by using
[quote]opener.document.MyForm.MyElement....</CODE>

if you gave win2 a name when opening, you can reference it from within win1
[quote]win2.document.MyForm.MyElement....</CODE>

Hope this helps you !




--
Steurm
www.steurm.net/steurm

sbaral
03-17-2004, 12:55 PM
Thank you Sterum! That worked wonderfully.