"riki" <ri******@hotmail.com> wrote in news:bv**********@ls219.htnet.hr:
hi,
i've asked this question before and didn't get an answer...maybe i
didn't explain it well so i'll try again...
--------------------------------------
main.html
i'm calling popUp like
window.open('/path/pic.jpg','popUp','toolbar=no, location=no etc.')
now...all pics don't have the same width and height so i don't wanna
fix manualy width and height for each pic...
--------------------------------------
popUp.html
instead i would like to write a function in the popUp.html that
resizes the window, but i don't know how to get hold of pic object so
i could extract width and height of individual pic...
<script lang=jscr>
picWidth=?
picHeight=?
</script>
--------------------------------------
thank you
Have you thought of using a function call that sends the width and height
of the image? I get the idea that you want the function to figure out the
height and width automatically, but I think you need to load the image to
get that info (I may be wrong on that, but I don't know how it would be
done). You do, however, already know the image's actual size and name.
In other words, if the window.open function is called "open_new()", and you
know the size of the images you want to show, just do this:
The HTML looks like this:
<IMG SRC="thumbnail001.jpg" WIDTH="80" HEIGHT="60"
onClick="open_new(400,300,'bigimg001.jpg');">
or
<A HREF="javascript
:open_new(400,300,'bigimg001.jpg') ;"><IMG
SRC="thumbnail001.jpg" WIDTH="80" HEIGHT="60"></A>
The JS looks like this:
function open_new(imgwid,imght,imgname) //width, height and name are sent
{
imgwid+=40; // adds 40 pixels in width - adjust as needed
imght+=60; // adds 60 pixels in height - adjust as needed
window.open(imgname,'_blank','width='+imgwid+',
height='+imght+',directories=0,menubar=0,resizable =1,scrollbars=0,status=0,
toobar=0');
}
Good luck, LJL