Solved

Window opener frame as target

Posted on 1998-11-29
3
2,057 Views
Last Modified: 2008-02-26
To open a new window, I use this JavaScript code : window.open("..."). In this window, when I submit a form, I want to know if this window is the son of another window and if it's the case, I want to display the result of the form action in a specific frame of the window opener. Is it possible and how I can do it ?

Thanks for your answer.

Thierry.
0
Comment
Question by:tplai
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 200 total points
ID: 1274762
Assuming you open the window thus:

self.name='theFather';
WinId = window.open(...)
if !(WinId.opener) WinId.opener = self;

then when submitting, you can ask
if(window.opener.parent.name == 'theFather')
   document.theform.target='framex'
else
   document.theform.target='framey'

Michel
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1274763
PS:
Be aware that target is read-only in IE3,
and a perhaps safer way would be to gather the form data and do a
if(window.opener.parent.name == 'theFather')
   window.opener.top.frames['FrameWhenFather'].location = 'http://myserver/cgi-bin/formcgi.pl?' + document.theFome.theElement.name+'='+document.theFome.theElement.value;

window.opener.top.frames['FrameWhenFather'].location
can alo be written
window.opener.top.FrameWhenFather.location

Michel
0
 

Author Comment

by:tplai
ID: 1274764
Thanks !
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question