[Javascript] resizing a new window

St=?ISO-8859-1?B?6Q==?=phane Leys leys.stephane at free.fr
Sat Jul 7 11:59:06 CDT 2001


Hi,

I'm new to both this list and JavaScript so, forgive me if my question has
already been discussed.

What I want to do : open a new window to show an image and resize the window
to the size of this image.

Here is what I do :

function openNewWindow(filenm,rsz)
{
var opt;           
opt='menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=y
es,resizable='+rsz+',dependent=yes,width=100,height=100';
thewd=window.open(filenm,"",opt);
thewd.resizeTo(thewd.document.images[0].width,
thewd.document.images[0].height);
     }

filenm is the URL of the html page where the image is declared as a IMG tag.

It works with IE 5.01 but it doesn't with Netscape communicator 4.77.
With Netscape, the window is opened, the image is shown but the window is
not resized.
The error is : thewd.document.images[0] has no properties

If I check thewd.document.images.length, I get 1 with IE but 0 with
Netscape.

If I do the resize in the page whose URL is passed in the filenm parameter,
it works.

Mac OS 8.6

Somebody could enlight me about this ?

TIA

BTW, is html mail allowed in this list ?

S. 

-- 
Stéphane Leys
http://leys.stephane.free.fr/





More information about the Javascript mailing list