Solved

Dismissing a window.

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now