Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1300 re: FAQ 877 Is it possible to make a pop-up window automatically resize to fit all the text and images contained in a page?

irt.org | Knowledge Base | JavaScript | Window | Q1300 [ previous next ]

Q1300 re: FAQ 877 Is it possible to make a pop-up window automatically resize to fit all the text and images contained in a page?

It is possible to dynamically resize a window according to the number of document links, anchors, images, array/form elements, applets, embedded objects, layers,list options, window frames, etc. using the length property

<html>
<head>
<title>window height resizes acording to # of anchors in the body</title>
</head>

<body>

<br><br>

<!-- name="___"  is REQUIRED for each anchor or  document.anchors.length   returns '0' -->
       
<a  name =""   href="URL1.htm">First Anchor</a><br>
<a name=""     href="URL2.htm">Second Anchor</a><br>

<script language = "JavaScript"><--

// increase window height by 16 pixels per anchor, min 400 pixels, to a maximum of 550 pixels
   popUpHeight=(400+(document.anchors.length*16));
   if ( popUpHeight > 550 ) popUpHeight = 550;
   window.resizeTo(400,popUpHeight);

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

Submitted by alu

Feedback on 'Q1300 re: FAQ 877 Is it possible to make a pop-up window automatically resize to fit all the text and images contained in a page?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.