That did the trick.
Thanks.
________________________
"Martin Honnen" <mahotrash@yahoo.de> wrote in message
news:3fa91e88$1@olaf.komtel.net...[color=blue]
>
>
> Irvin Amoraal wrote:
>[color=green]
> > Process:
> > I have a form which uploads a file from client to server written in PHP.
> > When the user presses the submit button, I use the "onSubmit" event to
> > execute javascript to open a child window containing some text and an
> > animated GIF. The javascript returns 'True' and the file is uploaded.[/color][/color]
All of[color=blue][color=green]
> > that works great.
> >
> > Problem:
> > Now I am trying to close the child window after the file has been[/color][/color]
uploaded.[color=blue][color=green]
> > Below is the JavaScript I'm using:
> >
> > Observations:
> > Error Msg: "progress is undefined".
> > I have observed that after form submission the 'if' statement in the[/color][/color]
'close[color=blue][color=green]
> > child window' code fails because the handle 'progress' appears to have[/color][/color]
no[color=blue][color=green]
> > value. My guess is that on form submission the handle 'progress' looses[/color][/color]
its'[color=blue][color=green]
> > value because the action for the form is to reload itself. The 'if'[/color][/color]
staement[color=blue][color=green]
> > does execute because I have placed an 'alert' statement just prior to it[/color][/color]
an[color=blue][color=green]
> > the 'alert' executed appropriately.
> >
> > If I try to open the window after submitting the form, the page doesn't[/color][/color]
open[color=blue][color=green]
> > until after the file has been uploaded, which defeats the purpose.
> >
> > Question:
> > How do I close the window after the form has been submitted?
> >
> > Thanks for your help!
> > Irvin.
> > __________________________________________________ _____
> >
> > Javascrtip Code:
> > __________________________________________________ _____
> >
> > To open the child window:
> > <script language="javascript">
> > var progress=null;
> > function sendfile() {
> >[/color][/color]
progress=window.open('test2.htm','progress','width =350,height=475');[color=blue][color=green]
> > return true;
> > }
> > </script>
> >
> > To close the child window:
> > This code follows my PHP code that verifies the file upload.
> > <script type="text/javascript" language="javascript">
> > if (progress && !progress.closed) {
> > progress.close();
> > }
> > </script>[/color]
>
> That doesn't help, on a new page the variable progress is not defined.
> All you can do on a new page is
> window.open('', 'progress').close();
> That way the window with name progress will be closed. Only shortcoming
> is if the user has already closed the window it will be reopened and
> then directly closed again.
>
> --
>
> Martin Honnen
>
http://JavaScript.FAQTs.com/
>[/color]