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, <f8*******************@news.demon.co.uk>