Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   Closing child window WITHOUT closing parent (http://www.velocityreviews.com/forums/t873337-closing-child-window-without-closing-parent.html)

thomas 10-23-2003 04:10 PM

Closing child window WITHOUT closing parent
 
Hi guys

I have a little problem: I am using another window to display images
on my website. The problem is that when I close the child window, it
closes the parent window too. I cannot find what is wrong.
This window is created with the following script:

function animUrl(url)
{
var p = 'scrollbars=yes,resizable=yes,toolbar=no,' +
'menubar=no,status=no,location=no,left=85,top=20';

var win = window.open("","animWindow",p);
win.document.writeln('<html>');
win.document.writeln('<head>');
win.document.writeln('<link type="text/css" rel="stylesheet"
href="mystyle.css">');
win.document.writeln('<script src="fitToSize.js"></script>');
win.document.writeln('</head>');
win.document.writeln('<body id="animWindow"
onload="fitToSize();">');
win.document.writeln('<img name ="imgTag" src="' + url + '">');
win.document.writeln('<p><a href="javascript:;"
onclick="self.close();">Close
window</a></p>');
win.document.writeln('</body>');
win.document.writeln('</html>');
win.document.close();
win.focus();

return false;
}

fitTosize is a simple function to change the window dimension
according to the image loaded:

function fitToSize()
{
if( window.document.images )
window.resizeTo(window.document.images[0].width+100,
window.document.images[0].height+50);
}

Ca somebody explain me where is the error?


All times are GMT. The time now is 01:29 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.