473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Close popup from next page

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
4 3177
"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

<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
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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: KS | last post by:
Is it possible to write a javascript that makes a popup window when someone click on buttons/href on my page and close itself when the new page is about to get loaded? I want to prevent the user...
4
by: -DRB- | last post by:
Hi, I'm probably going to get harassed just for mentioning the unmentionable, but since I have if anyone could answer this question that would be much appreciated. As per the rather long...
11
by: JSjones | last post by:
when a form is submitted from the main window i want a pop up window to open from the onclick event. i have that working, now how can i close the pop up window from the main window after the main...
4
by: Raymond Wilk | last post by:
I used javascript to open a new window, then used the following to close the new window on the next click: <body onBlur="self.close()" onClick="self.close()" bgcolor="#FFFFFF"> On the new window...
4
by: ...D. | last post by:
OK. I am halfway decent with HTML. Now I want to try javascript for some things that HTML cannot do. I have looked over a tutorial & all. What I want to do is create a button, that when...
4
by: GrantS | last post by:
I am having a problem closing a popup window opened modally. When I try to close the window (when the user hits save button and the data has been processed), the Popup window opens as a full screen...
4
by: louise raisbeck | last post by:
I have this scenario (simplified) function addnewdata () { check for partial match already in db for information entered by user if (partialmatch succeeds) { open new window aspx page (using...
2
by: julie.siebel | last post by:
I KNOW this can't be as hard as I am making it. I have a travel client with two related websites. On the homepage of the new site (Call it "Site A") I am building for them, there is a link to a...
5
by: lindanr | last post by:
In ASP.NET 2005 I have an onblur="window.close()" javascript event in the <body> tag. When I click on the window's scrollbar, the window closes. The same code works fine in ASP.NET 2003. Any...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.