Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 7th, 2005, 03:55 PM
Authorized User
 
Join Date: Dec 2003
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Open modal window and pass back url to parent

Hi,
I would like to open a modal window and pass back an URL to the parent page. Here is what I am trying to do without using Modal. How can I achieve this functionality with modal window?

Thanks..

This function is on the parent window.
-------------------------------------
function selUser() {
    var winl = (screen.width - 300) / 2;
    var wint = (screen.height - 600) / 2;
    var url = "testUser.asp";
    winDimentions = 'height=' + 500 +', width=' + 400 + ',top=' + wint + ',left=' + winl ;
    var styleWin = window.open (url, 'styleomattic', 'toolbar=0,location=no,directories=0,status=0,menu bar=0,scrollbars=1,resizable=1,' + winDimentions);
    styleWin.focus();
}
-----------------------------------------
This function on the child window.
---------------------------------
        function setUser(UID, sUName) {
               var url = "testUser.asp?SUID=" + UID;
        window.opener.location.href = url;
        window.self.close();
        return false;
    }



Reply With Quote
  #2 (permalink)  
Old April 7th, 2005, 07:49 PM
Authorized User
 
Join Date: Apr 2005
Location: , , USA.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

http://www.codestore.net/store.nsf/u...Q?OpenDocument

In a world of give and take, take all you can and you die with nothing. Give all you can and you die with honor.
Reply With Quote
  #3 (permalink)  
Old April 8th, 2005, 01:02 PM
Authorized User
 
Join Date: Dec 2003
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
Thanks for your reply. This code is working fine but when I click the link on the child window it's refreshing the parent page as well as opening the new window.What could be the problem?

On the parent window I changed the 'field.value' to 'self.location.href' to refresh the parent with new url.

Thanks..

Reply With Quote
  #4 (permalink)  
Old March 23rd, 2010, 08:03 AM
Authorized User
 
Join Date: Jan 2010
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to elizas
Default Refresh parent page on closing modal child window/popup

You cannot write a javascript function to refresh parent page from a Modal child pop-up window.

Instead, you can put the code to refresh the page just below the line that actually opens the modal popup in the parent page. Since code exceution on parent stops at the point when the modal pop window is opened, the next line is executed only after the modal popup has been closed. So if you put the reload call just below the call to open modal popup, the parent would refresh immediately the modal popup is closed.

Example - To refresh parent page on closing Modal child pop-up window.

....on Parent page

function OpenModalPopUP()
{
window.showModalDialog('page.aspx');
window.location.reload();
}
__________________
Cheers,
Eliza

Mindfire: India's Only Company to be both Apple Premier & Microsoft Gold certified.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Centering Popup window & Blur Parent window jkusmanto Javascript How-To 0 May 25th, 2007 03:19 AM
Referencing parent page from modal dialog gp_mk HTML Code Clinic 25 April 19th, 2007 01:28 PM
Forcing postback on parent page from modal dialog gp_mk ASP.NET 1.0 and 1.1 Professional 8 February 20th, 2007 12:44 PM
closed parent window when opened child window jaiwin Javascript How-To 0 October 8th, 2006 12:54 PM
Close Parent window on opening child window pkdev Javascript How-To 8 April 11th, 2004 12:06 PM



All times are GMT -4. The time now is 12:33 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.