Richard Bell wrote:
I'm a bit new to Javascript and am trying to do
oNewWin = window.open( ... );
then determine when the contents of oNewWin are completely loaded.
I've tried
oNewWin.attachEvent( "onload", myfunc);
but that doesn't work.
Can something of this sort be done?
Create a dummy document as follows:
--dummy.html--
<html>
<head>
<title>dummy.html</title>
</head>
<body onload="
if (window.opener && window.opener.callBack) {
window.opener.callBack();
}
">
</body>
</html>
Then structure your script to open the new window as follows:
<script type="text/javascript">
function callBack() {
alert('The new window has finished loading!');
}
oNewWin = window.open('dummy.html', 'theName', '...');
</script>
If you don't like the idea of creating dummy.html on your file system,
you could use:
var newDocument = [
'<html>',
'<head>',
'<title>dummy.html</title>',
'</head>',
'<body',
' onload="if (window.opener && window.opener.callBack)',
' window.opener.callBack();">',
'</body>',
'</html>'
].join('\n');
oNewWin = window.open('javascript
:newDocument', 'theName', '...');
All the usual warnings about popups apply (they may not be available,
they may be available but not do what you expect, they may open as new
tabs in an existing browser window, etc).
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq