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

Q1053 How can I open a popup window that is smaller than the main window?

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

The following simply opens a window two thirds the width and height of the main window in Netscape Navigator 4+ and Internet Explorer 4+:

<script language="JavaScript"><!--
var windowHandle;

function myOpen(url) {
    if(document.all) {
        var width = document.body.offsetWidth*2/3;
        var height = document.body.offsetHeight*2/3;
    }
    else if (document.layers) {
        var width = window.innerWidth*2/3
        var height = window.innerHeight*2/3
    }
    else {
        var width=640;
        var height=480;
    }

    windowHandle = window.open(url,'windowName','width=700,height=400,align=left,width='+width+'height='+height);
}
//--></script>

<a href="javascript:startToolbar('http://www.irt.org/')">text link</a>

©2018 Martin Webb