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('mycaption, 'http://www.mypage.com');
statement3;
When the window opens, JavaScript immediately executes statement 3.
I'd like:
statement1;
GB_show('mycaption, 'http://www.mypage.com');
wait-until-window-closes;
statement3;
Thanks for your help.
|
|
0
|
|
|
|
Reply
|
eddieandrews (10)
|
8/24/2007 1:31:27 PM |
|
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('mycaption, '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('mycaption, '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|object)\b/i.test(s);
}
function checkClosed(ms)
{
if (!w || w.closed)
{
if (isMethodType(typeof window.clearTimeout) && window.clearTimeout)
{
window.clearTimeout(t);
}
statement3;
}
else
{
t = window.setTimeout("checkClosed(" + ms + ")", ms);
}
}
statement1;
// retrieve the Window object reference
var w = ...
if (isMethodType(typeof window.setTimeout) && window.setTimeout)
{
var t = window.setTimeout("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, <f806at$ail$1$8300dec7@news.demon.co.uk>
|
|
0
|
|
|
|
Reply
|
Thomas
|
8/24/2007 2:02:41 PM
|
|
> 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.
|
|
0
|
|
|
|
Reply
|
Eddie
|
8/24/2007 4:46:30 PM
|
|
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 Multivisionsvortr�ge
http://www.image2d.com ::: Bildagentur f�r den alpinen Raum
|
|
0
|
|
|
|
Reply
|
Gregor
|
8/26/2007 9:03:08 PM
|
|
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
|
|
0
|
|
|
|
Reply
|
Thomas
|
8/26/2007 9:59:01 PM
|
|
|
4 Replies
379 Views
(page loaded in 0.007 seconds)
Similiar Articles: Wait until window closed before continuing - comp.lang.javascript ...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 cl... Al-Fakher Chicha - Acheter-Chicha.com - comp.lang.javascript ...Wait until window closed before continuing - comp.lang.javascript ... Al-Fakher Chicha - Acheter-Chicha.com - comp.lang.javascript ... Wait until window closed before ... help needed on DDE 'excel... works nicely to open EXCEL and wait the least amount of time, before continuing. ... I am not clear where the bug is, Windows ... help needed on DDE 'excel DDE EXCEL close ... A splash screen - comp.lang.java.gui... wait until all initialization is complete before calling setVisible(true) on the main window? ... until the main window becomes visible - at that point it will close. ... continuing ... Using Expect to spawn a perl process which spawns another perl ...Wait until window closed before continuing - comp.lang.javascript ... Using Expect to spawn a perl process which spawns another perl ... So it seems with expect the perl ... Missing reference - comp.databases.ms-accessClose the References window. Open it again and scroll down to ... Wait until PDFCreator is removed from memory ... that you set a reference first, before using ... Matlab GUIDE stability issue - comp.soft-sys.matlabI am using Matlab 2010a, on windows. I am making a ... Even if 1-39 have been closed. That sounds like a ... Just use it and wait until Matlab chokes in Java errors. serial ports: how do I know data has been sent? - comp.unix ...If it's to a peer, then you'll probably want to wait until ... protocol, after all the data was sent and before the ... when data has been completely sent within the Windows ... OpenGL for Linux: GF4-MX440-8X or FX5200? - comp.graphics.api ...Wait until window closed before continuing - comp.lang.javascript ... OpenGL for Linux: GF4-MX440-8X or FX5200? - comp.graphics.api ..... just on general principles ... ntpd, boot time, and hot plugging - comp.protocols.time.ntp ...... throw a valuable drift value out the window ... You may no longer be anywhere "close" to the ... maybe a second or more), you should wait until that adjustment is made before ... Wait until window closed before continuingI 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 Re: Wait until window closed before continuingRelevant Pages. Re: Wait until window closed before continuing... GreyBox is a JS window ... library that pretties up a window, usually for alerts and pop-ups.... 7/26/2012 11:44:31 PM
|