Forum Moderators: open
The function looks like this :
<script LANGUAGE="JavaScript">
<!--
function popImage(filename)
{
aWindow=window.open(filename,'Picture Viewer','status=no,menubar=no,scrollbars=no,toolbar=no,resizable=no,dependent=yes,modal=yes,dialog=yes');
aWindow.resizeTo(aWindow.document.images[0].width,aWindow.document.images[0].height);
}
// -->
</script>
An instance where I use it is here:
<a href="javascript: popImage('images/jul01army1.jpg');">
I also tried an onClick statement that looked like this:
<img src="images/jul01army1a.jpg" border="0"width="90" height="67" onClick="popImage('images/jul01army1.jpg');">
Neither of them work now, but it was just working the other day before i cleaned up the code a bit. What did i do wrong?
As a related point, I was browsing the older topics and I noticed that there are quite a few exceptions to details of Jscript that don't fit in with other browers' versions of JavaScript. Is it just that Jscript doesn't completely conform to the standard?
function popImage(filename)
{
aWindow=window.open(filename,'PictureViewer','status=no,menubar=no,scrollbars=no,toolbar=no,resizable=no,dependent=yes,modal=yes,dialog=yes,');
ht = 0;
wd = 0;
if(aWindow.height!= awindow.document.images[0].height ¦¦ aWindow.width!= awindow.document.images[0].width)
{
if (aWindow.height!= awindow.document.images[0].height) ht = aWindow.document.images[0].height - aWindow.document.images[0].height;
if (aWindow.width!= awindow.document.images[0].width) wd = aWindow.document.images[0].width - aWindow.document.images[0].width;
aWindow.resizeBy(wd,ht);
}
}
This works, as in the picture never gets any smaller, but now there's a lot more white space around each image and it doesn't resize as neatly to the image. I realize that (like Perl's motto) there's more than one way to do it, so I was wondering if anyone had some improvements or alternative suggestions.