Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Dismissing a window.

Posted on 2000-05-03
2
Medium Priority
?
190 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 400 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

972 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