Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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?

You are here: irt.org | FAQ | JavaScript | Window | Q1300 [ previous next ]

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?'

©2018 Martin Webb