Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop-up window according to size of image??

Status
Not open for further replies.

soonkhoo

Programmer
Dec 8, 2000
133
MY
Hi... I have a thumbnail pic that I like to pop open a window of a larger version. But I want the size of the pop up to follow the size of the pic. There might be some other way of doing it but I'm just worried about the 800x600 and 1024x768 problem. Thanks.

Soon
 
this technique should work, but this question belongs in the javascript forum. just pass the source of the image to startPreview (i only tested this in IE5.5):

Global_imageviewer = false;
function previewImage(isrc)
{
var height,width,str,spcs;

if(imagedimensions.readyState=="complete")
{
clearInterval(imgint_)
spcs = " "
str = &quot;about:&quot;+spcs+&quot;<body leftmargin=0 topmargin=0><img src='&quot;+isrc+&quot;'></body>&quot;
primgbutton.innerText = &quot;Preview Image&quot;;
primgbutton.disabled=false;
height = imagedimensions.height;
width = imagedimensions.width;
Global_imageviewer = window.open(str,&quot;imagepreview_window&quot;,&quot;width=&quot;+width+&quot;,height=&quot;+height)
}
}

function startPreview(isrc)
{
if(Global_imageviewer){if(!Global_imageviewer.closed)Global_imageviewer.close()}
imagedimensions.src=isrc;
primgbutton.innerText = &quot;(please wait)&quot;;
primgbutton.disabled=true;
imgint_ = setInterval(function(){previewImage(isrc)},1);
}

jared@eae.net -
 
Hmmm I tried passing values in it...but it returned error on me. I must be doing something wrong... I called startPreview(img/pic1.gif).

Thanks.

soon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top