In article <39************ **************@ posting.google. com>,
er*******@rcn.c om enlightened us with...
kaeli <ti******@NOSPA M.comcast.net> wrote in message news:<MP******* *************** **@nntp.lucent. com>... In article <39************ **************@ posting.google. com>,
er*******@rcn.c om enlightened us with...
What is a good way to synchronize, in other words to have my code know
when the window is ready to be interrogated ?
Have the new window run script onLoad telling opener that it loaded.
--
What are you proposing as an easy way for "telling opener" . If I
put
<body onLoad="HiImRea dy();">
the HiImReady function has to be in the html running in the new
window, but how can I call a function back in the html whose script
did the window.open ? (or did you mean something else entirely ???)
The opener has a global variable. Call it childIsOpen.
var childIsOpen = false;
The opener has a function to set that variable. Call it setChildIsOpen.
function setChildIsOpen( b)
{
childIsOpen = b;
return;
}
The child then tells the opener it loaded.
<body onLoad="window. opener.setChild IsOpen(true)">
The opener can then test that variable as
if (childIsOpen)
{
// whatever
}
Works in theory.
Let me test it and see...
Okay, this worked fine in IE. Test in any other browsers you'd like.
----------------------------------
test3.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title> New Document </title>
<script type="text/javascript">
var childIsOpen = false;
function setChildIsOpen( b)
{
childIsOpen = b;
return;
}
function openChild()
{
window.open("te st4.html","","t oolbars=no,widt h=100,height=10 0");
setTimeout("tes tChild()",1000) ;
}
function testChild()
{
if (childIsOpen)
alert("open!");
else
alert("nope!");
}
</script>
</head>
<body>
<form>
<input type="button" value="Click to open" onClick="openCh ild()">
</form>
</body>
</html>
-------------------------------
test4.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title> New Document </title>
<script type="text/javascript">
</script>
</head>
<body onLoad="window. opener.setChild IsOpen(true)">
test
</body>
</html>
--
--
~kaeli~
The man who fell into an upholstery machine is fully
recovered.
http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace