By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,915 Members | 1,334 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,915 IT Pros & Developers. It's quick & easy.

Close popup from next page

P: n/a
Hi,
I wrote an ASP-page which allows friends to upload a datafile which will be
processed and stored in a database. Because large files take some time to
process I want to open a popup 'Please wait, processing' with some fancy
graphics. So, onSubmit -> check form and open popup if correct.
When data is written into the database (and summary page has finished
loading) I want to close the popup.... although I named it winDialog
(winDialog = window.open(...)) the new page tells me it can't find this
popup ( if (window.winDialog) { winDialog.close() } ). Can anyone tell me
what's wrong? Maybe I'm doing things wrong. Or could you perhaps put me in a
right direction...

Thanks!
Jul 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Sjaakie Helderhorst" <pr**********@tell.you> wrote in message
news:40*********************@news.xs4all.nl...
<snip>
... the new page tells me it can't find this
popup ( if (window.winDialog) { winDialog.close() } )...

<snip>

When the page in a window (or frame) is changed everything from that
window (or frame) is destroyed. Including all JavaScript functions and
local variables. So window.winDialog does not exist on the new page
unless (or until) you create it. References to external objects within a
window (or frame) cannot survive the changing of the contents of that
window (or frame).

But pop-ups are so unreliable anyway that there is probably no point in
putting any significant effort into working round that restriction.
Probably better to display a (DHTML) notification in the page with the
form and let the arrival of the replacing page remove that.

Richard.
Jul 20 '05 #2

P: n/a

<html><body>

<% If Not Request.QueryString("zhid") = "showrecords" Then %>

<!-- PAGE 1 -->
<script language="JavaScript">
function myFunc(){

MyWindow=window.open('about:blank','MyWindow','too lbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=no,resizable=no,width=400,height= 200,left=200,top=100');

//IGNORE NEXT LINE ... JUST TO SIMULATE
PROCESSING PAUSE
for (i = 0; i <= 2000000; i++){}
}
</script>
<form name="myForm" action="?">
<input type="hidden" name="zhid" value="showrecords">
<input type="submit" name="theButton" value="Submit"
onClick="myFunc();">
</form>

<% Else %>

<!-- PAGE 2 -->
<script language="JavaScript">
MyWindow=window.open('','MyWindow','');
MyWindow.close();
</script>
Displaying Records
<% End If %>

</body></html>

I was just testing within one page ... the main thing is you have to
opwn the window again on the second page, and immediately close it

Brynn
www.coolpier.com

p.s. I do asp and javascript group ... thanks for posting in the
correct group =)


On Wed, 21 Jan 2004 14:12:46 +0100, "Sjaakie Helderhorst"
<pr**********@tell.you> wrote:
Hi,
I wrote an ASP-page which allows friends to upload a datafile which will be
processed and stored in a database. Because large files take some time to
process I want to open a popup 'Please wait, processing' with some fancy
graphics. So, onSubmit -> check form and open popup if correct.
When data is written into the database (and summary page has finished
loading) I want to close the popup.... although I named it winDialog
(winDialog = window.open(...)) the new page tells me it can't find this
popup ( if (window.winDialog) { winDialog.close() } ). Can anyone tell me
what's wrong? Maybe I'm doing things wrong. Or could you perhaps put me in a
right direction...

Thanks!


Brynn
www.coolpier.com

I participate in the group to help give examples of code.
I do not guarantee the effects of any code posted.
Test all code before use!
Jul 20 '05 #3

P: n/a
It's a rather unorthodox way of doing things, but it works (WOOHOO!) ... and
that's what counts for me :)
Thanks for the quick response!

Sjaakie

"Brynn" <z@z.com> schreef in bericht
news:40***************@news.comcast.giganews.com.. .
I was just testing within one page ... the main thing is you have to
opwn the window again on the second page, and immediately close it

Brynn
www.coolpier.com

On Wed, 21 Jan 2004 14:12:46 +0100, "Sjaakie Helderhorst"
<pr**********@tell.you> wrote:
Hi,
I wrote an ASP-page which allows friends to upload a datafile which will beprocessed and stored in a database. Because large files take some time to
process I want to open a popup 'Please wait, processing' with some fancy
graphics. So, onSubmit -> check form and open popup if correct.
When data is written into the database (and summary page has finished
loading) I want to close the popup.... although I named it winDialog
(winDialog = window.open(...)) the new page tells me it can't find this
popup ( if (window.winDialog) { winDialog.close() } ). Can anyone tell me
what's wrong? Maybe I'm doing things wrong. Or could you perhaps put me in aright direction...

Thanks!


Brynn
www.coolpier.com

I participate in the group to help give examples of code.
I do not guarantee the effects of any code posted.
Test all code before use!

Jul 20 '05 #4

P: n/a

The only lines of code that matter there are

MyWindow=window.open('','MyWindow','');
MyWindow.close();

I just posted the entire test page I was using.

you have to create the object again (which will replace the old) so
that the page knows what object you are talking about.

....glad it works for ya =)

Brynn
www.coolpier.com

On Wed, 21 Jan 2004 15:53:52 +0100, "Sjaakie Helderhorst"
<pr**********@tell.you> wrote:
It's a rather unorthodox way of doing things, but it works (WOOHOO!) ... and
that's what counts for me :)
Thanks for the quick response!

Sjaakie

"Brynn" <z@z.com> schreef in bericht
news:40***************@news.comcast.giganews.com. ..
I was just testing within one page ... the main thing is you have to
opwn the window again on the second page, and immediately close it

Brynn
www.coolpier.com

On Wed, 21 Jan 2004 14:12:46 +0100, "Sjaakie Helderhorst"
<pr**********@tell.you> wrote:
>Hi,
>I wrote an ASP-page which allows friends to upload a datafile which willbe >processed and stored in a database. Because large files take some time to
>process I want to open a popup 'Please wait, processing' with some fancy
>graphics. So, onSubmit -> check form and open popup if correct.
>When data is written into the database (and summary page has finished
>loading) I want to close the popup.... although I named it winDialog
>(winDialog = window.open(...)) the new page tells me it can't find this
>popup ( if (window.winDialog) { winDialog.close() } ). Can anyone tell me
>what's wrong? Maybe I'm doing things wrong. Or could you perhaps put mein a >right direction...
>
>Thanks!
>
>


Brynn
www.coolpier.com

I participate in the group to help give examples of code.
I do not guarantee the effects of any code posted.
Test all code before use!



Brynn
www.coolpier.com

I participate in the group to help give examples of code.
I do not guarantee the effects of any code posted.
Test all code before use!
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.