[thelist] Submit a form and shut the window

Jonathan Dillon jonathan at boehm-ritter.com
Tue Feb 1 16:16:27 CST 2005

> Not 100% sure, but I think that would close the window before the form
submitted as you typically use onsubmit with a return:
onsubmit="return somefunction();"

You can do it in a number of ways.

1) http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/target.html
Check out the date on that sucker.  You can use TARGET="_parent"

2) http://www.experts-exchange.com/Web/Web_Languages/HTML/Q_21074226.html
You can reference the parent window with a script

In either case, in the body of your document, or in an included .js file,
put window.close();  

This is the universally supported way of closing windows, and is part of
REF: http://www.mozilla.org/docs/dom/domref/dom_window_ref9.html,

That's the definitive-esque answer.

You can also do a window.close() in a timer function so that you give the
user a chance to close the window on their own if you want to.  I personally
find that annoying, but whatever.


More information about the thelist mailing list