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

Q1397 How do I set the size and position two windows to take up 80% and 20% of the screen height and place them one above the other?

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

You may have to adjust for the size of additional window fixtures (e.g. taskbars etc), but the following should give you a general idea of how to go about doing this:

<script language="JavaScript"><!--
function openWindows() {
    var windowwidth = 630, topheight = 400, bottomheight = 40; // default sizes

    if (window.screen) {
        windowwidth = window.screen.availWidth;
        topheight = (window.screen.availHeight * 80 / 100) - 20;
        bottomheight = (window.screen.availHeight * 20 / 100) - 20;
    }

    window.open('about:blank','windowNameTop','width='+windowwidth+',height='+topheight+',screenX=0,screenY=0,top=0,left=0');

    window.open('about:blank','windowNameBottom','width='+windowwidth+',height='+bottomheight+',screenX=0,screenY='+topheight+',top='+topheight+',left=0');
}

openWindows();
//--></script>

©2018 Martin Webb