T
thomas
HI
I've written a simpole script to open a new window with an image and
resize the window depending on the image size: it is
function fitToSize()
{
if( window.document.images )
window.resizeTo(window.document.images[0].width+100,
window.document.images[0].height+50);
}
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="../style/styleThomas.css">');
win.document.writeln('<script
src="../js/animWindow.js"></script>');
win.document.writeln('</head>');
win.document.writeln('<body id="animWindow"
onload="fitToSize();">');
win.document.writeln('<img name ="imgTag" class="center" 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.resizeTo(win.document.images[0].width,200);
win.focus();
return false;
}
It is very simple. I call it with the following in the html pages:
<a href="javascript:;" onclick="return animUrl('image.gif');">A Gif
image</a>
Clicking on the link crash explorer that immediately freezes.
It works well everywhere else, excpet Opera that complain with an
obnoxious message.
Does anybody see what's obviously wrong in my code?
Thanks
Thomas
I've written a simpole script to open a new window with an image and
resize the window depending on the image size: it is
function fitToSize()
{
if( window.document.images )
window.resizeTo(window.document.images[0].width+100,
window.document.images[0].height+50);
}
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="../style/styleThomas.css">');
win.document.writeln('<script
src="../js/animWindow.js"></script>');
win.document.writeln('</head>');
win.document.writeln('<body id="animWindow"
onload="fitToSize();">');
win.document.writeln('<img name ="imgTag" class="center" 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.resizeTo(win.document.images[0].width,200);
win.focus();
return false;
}
It is very simple. I call it with the following in the html pages:
<a href="javascript:;" onclick="return animUrl('image.gif');">A Gif
image</a>
Clicking on the link crash explorer that immediately freezes.
It works well everywhere else, excpet Opera that complain with an
obnoxious message.
Does anybody see what's obviously wrong in my code?
Thanks
Thomas