Click to See Complete Forum and Search --> : new fixed window according to image?


swtiemiss
04-27-2003, 01:44 AM
hi.

is it possible to make a link open a new window fixed to the size of an image rather than making a whole new html for that image?

i want something like <a href="image.jpg">text</a> i know if i put target="_blank" it will open a whole new window, but i don't want the image to open with a lot of blank space. i just want the link to open the window fixed to the image size.

is this possible? please help me. thanks.

khalidali63
04-27-2003, 09:31 AM
what you can possibly do is,
1. create image object,

then in windows properties

width="+img.width and same with height.

that should do it.

swtiemiss
04-27-2003, 09:54 PM
Thanks Dave. That's EXACTLY what I want. But why isn't it working on my site? I've been trying to alter it and it's getting me so frustrated because it's not working. :mad:

Here's what I've put on my HTML:
<a href="http://www.geocities.com/tokyo/island/8876/polar/polaroids2.jpg"
target="_blank"
onclick="window.open('image_viewer.html?'+escape('http://www.geocities.com/tokyo/island/8876/polar/polaroids2.jpg'),null,'scrollbars=no,resizable=yes',1);return false;"><img src="http://www.geocities.com/tokyo/island/8876/polar/polaroids2.jpg" alt="click"></a>

It's practically identical to yours but when I click on it, the page with the image can't be found. Any ideas on what's wrong?

swtiemiss
04-27-2003, 11:29 PM
No.... :p Ok, now i made image_viewer.html, do I have to put anything in that HTML file?

pyro
04-28-2003, 08:12 AM
Yes, you need to add something like the following to your image_viewer.html page:

<html>
<head>
<title>Image Viewer</title>

<script language="javascript" type="text/javascript">
function resizePage() {
if (!window.innerWidth) {
window.resizeTo(document.images[0].width+12,document.images[0].height+38);
}
else {
window.innerWidth = document.images[0].width;
window.innerHeight = document.images[0].height;
}
}
</script>
</head>

<body style="margin:0px;" onload="resizePage();">
<script language="javascript" type="text/javascript">

pic = unescape(window.location.search.substr(1));
document.write ('<img name="myimg" src="'+pic+'" border=0>');

</script>
</body>
</html>

swtiemiss
04-28-2003, 08:45 PM
*YAY!* Thank you thank you all! :D