OnSubmit="self.close()" doesn't work on NN4

I have the following problem, and I'll be 4ever in debt to the solver...
I have a window named "mainref" with the file index.asp loaded into, wich opens another
window with the function below:
and this works well;
in the target window I have a form defined as below:
<form name="name_form" action="index.asp" target="mainref"
I have to close the window "windowref" when the form is submitted, so i wrote the function
LEAVETHIS as following:
function LEAVETHIS()
The self.close is executed after the form submission with MS IE 4.0 and Netscape 3.0, but
with Netscape 4.03 (the latest release i found...) the submission of the form isn't executed at
Thanks to all those will reply this question.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The submission isn't executed? It normally takes a short moment to contact the server etc. Your close might just be faster... (the onSubmit is executed BEFORE the form is submitted to allow validation).

Try this:
That will close the window 3 seconds later. A shorter time might be enough, just experiment, but allow a little time extra if the computer or the network connection is slower somewhere else.

Let me know if that solved the problem. btw: If that was the reason, you have to admit that NN4 has the "more correct" behavior! The onsubmit is executed before your form is submitted and it closes the window. Tough for the form ;-)

Good luck!
I don't believe the self.close() or window.close() will work because the windowref window is not your current window.  Instead use windowref.close() in the script and it should work ok.  You also won't need the setTimeOut function.  I don't believe the speed of the machines is the issue.
hmm... maybe you should read the question before blocking it for everybody else?

1] windowref=window.open("target.asp","windowname","width=480,height=320")
in the *****target***** window I have a form defined as below:
<form name="name_form" action="index.asp" target="mainref" OnSubmit="LEAVETHIS()">
==> self.close() or window.close() are correct, the target window closes ITSELF (also indicated by closeTHIS)
2] The self.close is executed after the form submission with MS IE 4.0 and Netscape 3.0, but with Netscape 4.03 .... => If it works with two browsers (esp NN3), a wrong reference can hardly be the reason for it not working with a third browser.
3] The question says the FORM SUBMISSION isn't executed. The window DOES close...

Wiz_Of_OZ, let me know if the Timeout helped...
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Wiz_of_OzAuthor Commented:
the problem isn't the self.close(), but the form submission...

Wiz_of_OzAuthor Commented:
Thanks Holger...
I tried with a Timeout and magically everything works :)
4 ever in debt to u...

Glad to hear that Holger's suggestion worked, if you
are passing the form to a CGI, then you could also
have the CGI program whip out a quick page which
just closes the window, That way everytime the information
is submitted, even accross very slow networks, you are
gauranteed of success.

Robin (twexperts)
My apologies.  I would not have locked up the question if I did not believe I had an answer.  If you had the answer why didn't you lock the question up?
I see here some problems can be:
even if you set close after timeout
if connection is slow window can be closed BEFORE
submission occures in some browsers.
So data wouldn't submited.

In order to be sure data was submited you should
follow twexperts suggestion. ie close this window
when you receive CGI responce.
Just return in responce HTML containing


Again I think priority of this answer
may be not complete enough should be
twexperts :)

I didn't post an answer right away because I couldn't be absolutely sure that it was the timing that caused his problem and wanted to keep the question open just in case somebody had had the exact same problem and knew that it was something else. Glad to hear that it helped!

About twexperts comment: Yes, that idea is not so bad either. The only problem is that his form has a TARGET to the main window (wouldn't make much sense to close it otherwise, would it? ;-) which doesn't have a reference to the other (smaller) window any more when the new page loads. He can always get a new one with ref=window.open ("","windowname") of course, but as long as this code works, it's probably easier. Even with slow connections, he doesn't need to receive the answer in that time. He only needs to give Netscape a short moment to send the data, because "technically", the onsubmit is executed before the form is submitted, so it's kind of a bug that Netscape 3 and IE still send the form after the window was supposed to close...

Good luck with your page!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.