Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 12th, 2006, 08:24 AM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to acedanger Send a message via MSN to acedanger Send a message via Yahoo to acedanger
Default Refreshing "main" page from "pop up" window

I need some help with some javascript. From my main screen, I'm using a window.open() to open a popup window with a form and a submit button. What I want to happen is that when the user clicks the submit button, the popup window closes and the main page refreshes itself. I'm sure this is possible but I just don't know how to do it. Could someone help me out?

 
Old May 12th, 2006, 08:32 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

In your popup use a standard button rather than a submit button and add a handler to its onclick attribute:
Code:
<input onclick="handleSubmit();" type="input" value="Submit">
Your handleSubmit function is:
Code:
function handleSubmit()
{
  document.forms[0].submit();
  self.opener.location.reload();
  self.close();
}
--

Joe (Microsoft MVP - XML)
 
Old May 12th, 2006, 08:44 AM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to acedanger Send a message via MSN to acedanger Send a message via Yahoo to acedanger
Default

Joe, That worked. Thank you for your help.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Window refresh and window pop up in Java Script Aleksandra Javascript How-To 2 March 2nd, 2007 06:47 PM
Refreshing a page based on action in pop-up nkrust ASP.NET 1.0 and 1.1 Basics 4 January 15th, 2007 04:21 PM
Refreshing Property Window? Kaprice Visual Studio 2005 11 November 11th, 2006 08:49 PM
How to pass values to main page from Popup window rmanmeet ASP.NET 1.0 and 1.1 Basics 1 January 5th, 2006 01:44 PM
refreshing XML withour refreshing the page sasidhar79 XML 1 January 12th, 2005 05:16 AM





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