473,546 Members | 2,244 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Wait until window closed before continuing

I am opening a windows (well, technically a greybox() call GB_show()
which shows a nicer window than normal), and want to wait until that
window is closed before moving to the next command. However, when I
open the window, JavaScript immediately issues the next command
statement. How can I get JavaScript to wait until the window is
closed before continuing? Here's visually what I'm trying to do:

statement1;
GB_show('mycapt ion, 'http://www.mypage.com' );
statement3;

When the window opens, JavaScript immediately executes statement 3.
I'd like:

statement1;
GB_show('mycapt ion, 'http://www.mypage.com' );
wait-until-window-closes;
statement3;

Thanks for your help.

Aug 24 '07 #1
4 11083
Eddie wrote:
I am opening a windows (well, technically a greybox() call GB_show()
What is a greybox(), please?
which shows a nicer window than normal),
Assuming it is still a Window object, do you realize this is probably based
on a browser bug?
and want to wait until that window is closed before moving to the
next command. However, when I open the window, JavaScript immediately
issues the next command statement. How can I get JavaScript to wait
until the window is closed before continuing?
You cannot (ref. FAQ 4.20), but see below.
Here's visually what I'm trying to do:

statement1;
GB_show('mycapt ion, 'http://www.mypage.com' );
BG_show() is not a built-in method. Unless you say what your library is,
better what it actually does, only people experienced with that library can
help you. Given the number of libraries out there, and most of them being
bad, it is unlikely to find such a person here.
statement3;

When the window opens, JavaScript immediately executes statement 3.
I'd like:

statement1;
GB_show('mycapt ion, 'http://www.mypage.com' );
wait-until-window-closes;
statement3;
Modal windows would be a solution, but they are MSHTML-proprietary.

Assuming this is about a Window object, you could check if the window was
closed once in a while:

/**
* @see http://pointedears.de/scripts/types.js
*/
function isMethodType(s)
{
return /\b(function|obj ect)\b/i.test(s);
}

function checkClosed(ms)
{
if (!w || w.closed)
{
if (isMethodType(t ypeof window.clearTim eout) && window.clearTim eout)
{
window.clearTim eout(t);
}

statement3;
}
else
{
t = window.setTimeo ut("checkClosed (" + ms + ")", ms);
}
}

statement1;

// retrieve the Window object reference
var w = ...

if (isMethodType(t ypeof window.setTimeo ut) && window.setTimeo ut)
{
var t = window.setTimeo ut("checkClosed (250)", 250);
}
HTH

PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8************ *******@news.de mon.co.uk>
Aug 24 '07 #2
What is a greybox(), please?

Sorry. GreyBox (http://orangoo.com/labs/GreyBox/) is a JS window
library that pretties up a window, usually for alerts and pop-ups.
BG_show() is not a built-in method...
Actually, it's GB_show() and it's the call to the window. I don't
want to get sidetracked on GreyBox, since it's identical to issuing a
call to open a window. It behaves the same way either way, and since
it's a windows, it can be called using normal JavaScript. It's the
waiting until the window closes that's the real issue.

I'll check out your code sample to see if that helps. Thanks.

Aug 24 '07 #3
Eddie meinte:
>What is a greybox(), please?

Sorry. GreyBox (http://orangoo.com/labs/GreyBox/) is a JS window
library that pretties up a window, usually for alerts and pop-ups.
Actually, it's GB_show() and it's the call to the window. I don't
want to get sidetracked on GreyBox, since it's identical to issuing a
call to open a window. It behaves the same way either way, and since
it's a windows, it can be called using normal JavaScript. It's the
waiting until the window closes that's the real issue.
1. Well, it's *not* a window. It's an ordinary div.
2. Thomas' code won't work, since it relies on a *window*.
3. Solution: Change the GB code that returns immediately after opening
the "window" (and attaching a "close"-handler to the close-"button"),
that it doesn't return and instead waits explicitly for the closing click.
4. On the mentioned website they state that there is a greybox group on
google groups. Why not ask there?
I'll check out your code sample to see if that helps. Thanks.
I doubt it will.

Gregor

--
http://www.gregorkofler.at ::: Landschafts- und Reisefotografie
http://www.licht-blick.at ::: Forum für Multivisionsvor träge
http://www.image2d.com ::: Bildagentur für den alpinen Raum
Aug 26 '07 #4
Gregor Kofler wrote:
Eddie meinte:
>>What is a greybox(), please?
Sorry. GreyBox (http://orangoo.com/labs/GreyBox/) is a JS window
library that pretties up a window, usually for alerts and pop-ups.

Actually, it's GB_show() and it's the call to the window. I don't
want to get sidetracked on GreyBox, since it's identical to issuing a
call to open a window. It behaves the same way either way, and since
it's a windows, it can be called using normal JavaScript. It's the
waiting until the window closes that's the real issue.

1. Well, it's *not* a window. It's an ordinary div.
2. Thomas' code won't work, since it relies on a *window*.
It can be modified so that it does not wait for a window to be closed, but
for the `div' element no longer to be displayed.
3. Solution: Change the GB code that returns immediately after opening
the "window" (and attaching a "close"-handler to the close-"button"),
that it doesn't return and instead waits explicitly for the closing click.
That is another possibility. Or GreyBox has means of its own.
4. On the mentioned website they state that there is a greybox group on
google groups. Why not ask there?
In this case I'd rather he asks here instead of getting supposed bad advice
from the people with supposed smattering there.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Aug 26 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
12879
by: GTi | last post by:
Hello... I have a page located in a frame. This page contains a form. When the user submit this form I want to popup a "Please Wait" window popup window The post may take some time for the server to process. So when the new windows is loaded into the browser, I want to close this Wait window. I have found a global JavaScript variable I...
4
4902
by: Aaron Fude | last post by:
Hi, I have report that takes about 5-10 seconds to generate depending on the load. I want to show the user a progress bar while it is being generated and when it's done, forward the browser to the report. Any suggestions? Thank you!
3
4618
by: John Dalberg | last post by:
Hi I have a form that opens a new window for the results. Because the results might take a few seconds due to server processing, I would like to display a message "please wait" in the new window, erase that message when the processing is done and show the results. How is this done? John Dalberg
14
5430
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net that works well as an html page. It brings up a modal popup window that I have been trying to work out for days now and this was the closest I...
4
17066
by: Peter | last post by:
I am using CreateProcessWithLogonW to run an external application, the problem I am having is that the C# program does not wait until the external program finishes running before continuing. The external program is a console application and it does not interact with users, how can I make my C# program wait until the program initiated by...
2
1877
by: AccessPro | last post by:
Hi, I am creating an image-management database. I want my users to be able to double-click on an image (a preview of what exists in a network subfolder), and for the code to open the image in its associated application (say, Microsoft Photo Editor), then wait for the user to close the window before continuing code execution. I know I can...
3
6425
by: Neekos | last post by:
I'm programatically opening IE and i need my code to wait until the browser is finished loading before continuing. How do i make it wait? i tried: Do DoEvents Loop Until webBrowser1.Busy = False but this doesnt work.
2
3088
by: Doug | last post by:
Is there a way to get the VB code that opens a popup to wait until the popup is closed before continuing?
0
7507
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7435
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5361
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1922
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.