Solved

Returning control back ...

Posted on 2001-09-08
9
159 Views
Last Modified: 2006-11-17
Returning control back to the parent when closing a popup window.

I am creating a popup window and would like to know how to refresh the calling window when I close the popup.

Thanks for your help!!!

Candis
0
Comment
Question by:Candis_Sue
  • 5
  • 4
9 Comments
 
LVL 1

Expert Comment

by:baltman
ID: 6467337
Candis,

If you close the popup window, it would automatically put the focus back on the previous window, unless the user has opened other applications in between....
You wanted to "refresh" the main page?

BA
0
 

Author Comment

by:Candis_Sue
ID: 6467344
Here is what I'm doing...

I am opening up a popup window so that a user can upload an image.  Once the user has selected and viewed the image in the popup, I want to pass a parameter to the main page so that it knows what image was selected.  Just a second.  I could keep this in Session I bet... one second.
0
 
LVL 1

Accepted Solution

by:
baltman earned 150 total points
ID: 6467348
In the opening page, place the following code between the <HEAD> Tags:

<SCRIPT LANGUAGE="JavaScript">
<!--
function loadMain()
     {
     window.opener.location.href="test2.html";
     }
//-->
</SCRIPT>


and add the following line in the <BODY> tag:

<BODY onUnLoad="loadMain();">


You would have to replace the "test2.html" with whatever page you want the main window to open....

BA
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:Candis_Sue
ID: 6467354
Interesting, I'll try that  :)

Thanks!!!
0
 

Author Comment

by:Candis_Sue
ID: 6467359
Interesting, I'll try that  :)

Thanks!!!
0
 

Author Comment

by:Candis_Sue
ID: 6467364
That works like a charm!!!  Thanks SOOO MUCH!!!!

Candis  :)
0
 
LVL 1

Expert Comment

by:baltman
ID: 6467366
Aha, i see. The code I provided above would just get you to another page, not pass a variable back to the main window. But I think you could do that in much the same way:

replace the window.opener.location.... line with:
window.opener.document.forms[0].elements[0].value = "Test";

Where forms[0] would be the name of the form (if it has one) and elements[0] the form element (could be a hidden input field or something) where you want to pass the value to. "Test" could be anything you place in the opened window...
0
 

Author Comment

by:Candis_Sue
ID: 6467368
Gave you a few extra points for all your help!!!

Thanks again!!!
0
 
LVL 1

Expert Comment

by:baltman
ID: 6467374
No problem at all! Anytime! :) Thanks!
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

815 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now