I already lost some hours trying to figure out how to solve a javascript problem. I have a JS function that opens a popup window:
function openSearchWindow(searchType, targetIdField, targetDescField)
and I set 2 properties to this new window:
var win = window.open(searchPage, searchType + "search", style);
win.targetIdField = targetIdField;
win.targetDescField = targetDescField;
Until here, everything works perfectly. In my popup window, however, I need to access these two variables I set previously: win.targetIdField and win.targetDescField
How can I access them? I tried almost everything.
EDIT - In time,
In the popup window I have a search engine actually. When user clicks in a result, there is a JS function that gets the ID and DESCRIPTION of the selected item and passes it back to the "opener" window, placing them in the targetIdField and targetDescField, respectively.
EDIT (2)
Once the search is performed in the popup (through a servlet) the popup's URL changes, but it's always within the same domain.
Thanks in advance.
Lucas.
Have you tried accessing them through window.targetIdField? If thait does not work, you could bind the 2 properties on the parent window (using window.targetIdField instead of win.targetIdField) and then access those from your opened window using window.opener.targetFieldid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With