Closed Thread Icon

Topic: Help cobbling JS for open win > image fit (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=10849" title="Pages that link to Topic: Help cobbling JS for open win &amp;gt; image fit (Page 1 of 1)" rel="nofollow" >Topic: Help cobbling JS for open win &gt; image fit <span class="small">(Page 1 of 1)</span>\

 
warjournal
Maniac (V) Mad Scientist

From:
Insane since: Aug 2000

posted posted 11-05-2002 21:02

JS is definitely not my strong suit. I can cobble some simple scripts together with some trial-n-error. That's what I'm doing right now, but I would like some help to expediate matters.

I have a thumbnail. Its linked to an image. The image opens in a new window.
How do I fit the new window to the image's dimensions?

I'll be using whatever.document.write('<html>');
for the new window, but I'm having problems figuring out how to get the height/width and passing them on.

Mucho appreciated.

edit: Wrong forum. Sorry about that. Somebody capable willing to move it?


[This message has been edited by warjournal (edited 11-05-2002).]

warjournal
Maniac (V) Mad Scientist

From:
Insane since: Aug 2000

posted posted 11-05-2002 23:03


From the reading I've been doing, I can set the height/width, but not grab.

Veneficuz
Paranoid (IV) Inmate

From: A graveyard of dreams
Insane since: Mar 2001

posted posted 11-05-2002 23:25

I had no problem grabbing the size of an image using document.getElementById["name"].width or document.getElementById["name"].height. You just have to make sure that the images are loaded before trying to get the dimensions. Doesn't that method work for you?


[edit] I write two lines and still manage to get a couple of typos [/edit]
_________________________
Anyone who has lost track of time when using a computer knows the propensity to dream, the urge to make dreams come true and the tendency to miss lunch.
- copied from the wall of cell 408 -

[This message has been edited by Veneficuz (edited 11-05-2002).]

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 11-06-2002 00:14

You really need the size of the full image before it is loaded which is tricky.

2 solutions:

1. Use server-side scripting - you can then generate the thumbnails dynamically.

2. Resize the window after you have popped it up.

I'll move this to JavaScript/DHTML now.

___________________
Emps

FAQs: Emperor

« BackwardsOnwards »

Show Forum Drop Down Menu