Solved

Dismissing a window.

Posted on 2000-05-03
2
160 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
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 …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

831 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