Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Dismissing a window.

Posted on 2000-05-03
2
167 Views
Last Modified: 2010-04-09
I have a page that contains a javascript function to open a window containing a form. What I'd like to have happen is when the user clicks the submit button the window goes away and the cgi activated by the form reports its output to the main window (where the function was initially called from).

I tried using the onSubmit event to call window close.  

  w.document.write("<FORM METHOD='POST' ACTION='cgi6.exe' onSubmit='w.close();return true'>")

But this doesn't work. The out put from cgi6 gets written to the main browser window.

Is this possible?
0
Comment
Question by:winkle
  • 2
2 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 100 total points
ID: 2774834
You simply need to specify the target of the main window in your form:

  w.document.write("<FORM TARGET='NameOfTheMainWindow' METHOD='POST' ACTION='cgi6.exe' onSubmit='setTimeout(\"w.close()\",500);return true'>") ;

also, note the setTimeout for the w.close()
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 2774846
Also, you can set the name of the main window like this:

  self.name="NameOfTheMainWindow";

(obviously, this needs to be executed in the main window)
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

828 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