PDA

Click to See Complete Forum and Search --> : image size


shahid
May 14th, 2003, 04:01 AM
hi i have some link on my page

when some one click the the links
i want to get 1st the image on server then the window open

with the image size....

i wrote this code but it's work some time ....

function getwin(msrc)
{
var mm = new image()
mm.src = msrc
imgh = mm.height
imgw = mm.width

window.open('test1.htm?src='+msrc,'_blank','height='+imgh+',width='+imgw+',top=0,left=100')

}
can some help plz
thanks

ai.unit
May 16th, 2003, 10:04 AM
not sure, but maybe u need to wait till the mm object is fully loaded from the server before reading its dimensions,
like:

while (mm.readyState!='complete') wend

not sure, coz i'm not too good in java, but it should be something like this. u can avoid a deadlock by specifying a time out or some other condition...

shahid
May 17th, 2003, 12:15 AM
Thanks about the tip....

but is it possible to know that the image has been download completely.

ai.unit
May 17th, 2003, 01:12 AM
yes, that's what i was saying,
when the image is loaded completely, it's state would be 'complete':

img.readyState=='complete'


check the msdn for the img object properties:
http://msdn.microsoft.com/library/default.asp

shahid
May 17th, 2003, 03:40 AM
thank you so much