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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need to resize a pop up window to the size of a picture

Status
Not open for further replies.

fiuPikeOY

Programmer
Jun 14, 2004
143
US
Hello,

Does anybody know how to resize a pop up to the height of the picture it contains + 50px (for text on top and bottom), the width will just be the width of the picture.

size = (picture H + 50) x (picture W)

Thanks in advance
 
Code:
function resizeWindow(img)
{
  resizeTo(parseInt(img.style.width), parseInt(img.style.height)+50);
}
Does that work?

--Chessbot

"Violence is the last refuge of the incompetent." -- Asimov, Foundation
 
Not really man, it didn't work. Anything I can try?
 
How are you calling it?

--Chessbot

"Violence is the last refuge of the incompetent." -- Asimov, Foundation
 
You need to send the image with the function. Sample page:
Code:
<html>
<head>
<title>image</title>
<script type="text/javascript">
<!--

function resizeWindow(img)
{
  resizeTo(parseInt(img.style.width), parseInt(img.style.height)+50);
}

// -->
</script>
</head>
<body onload="resizeWindow(document.getElementById('the_img'));">
<img name="the_img" id="the_img" src="pic.jpg" width="100" heigh="200">
</body>
</html>

--Chessbot

"Violence is the last refuge of the incompetent." -- Asimov, Foundation
 
The pictures are brought in from a database. This is a dynamic page. Can your method still work.

Thanks
 
Depends. Do you have a page that outputs an image file based on the information (.gif, .jpg, etc) or are you doing that on the page? You would need a separate pag for it to work.

--Chessbot

"Violence is the last refuge of the incompetent." -- Asimov, Foundation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top