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

Q1159 How can I open a popup windows to fit the dynamically written contents?

irt.org | Knowledge Base | DHTML | Q1159 [ previous next ]

Q1159 How can I open a popup windows to fit the dynamically written contents?

Try:

<body onLoad="openWindow(1)">

<script language="JavaScript"><!--
var windowHandle = null
function openWindow(i) {
    var width=100, height=100;
    if (document.layers) {
        width = document.layers['myId' + i].document.width + 40;
        height = document.layers['myId' + i].document.height;
    }
    else if (document.all) {
        width = document.all['myId' + i].style.width + 40;
        height = document.all['myId' + i].style.height;
    }
    windowHandle = window.open('about:blank','windowName','width=' + width + ',height=' + height);
    setTimeout('updateWindow(' + i + ')',1);
}

function updateWindow(i) {
    windowHandle.document.open();
    windowHandle.document.write('How wide<br>and how<br>high is this<br>layer');
    windowHandle.document.close();
}
//--></script>

<div id="myId1" style="position:absolute; visibility: hidden;">
<script language="JavaScript"><!--
if (document.all || document.layers)
    document.write('How wide<br>and how<br>high is this<br>layer');
//--></script>
</div>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


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