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

Feedback on: irt.org FAQ Knowledge Base Q1316, January 17, 2002 at 12:40:32:

You are here: irt.org | About | Feedback | 3497 [ previous next ]

Feedback on:
irt.org FAQ Knowledge Base Q1316

Sent by
Sean McLeary on January 17, 2002 at 12:40:32:

Technical:
Not technical enough

Comments:
the suggested method for centering the pop-up over the browser window does not take into account the distance the browser window is separated (top and left) from the top-left-hand corner of the screen. try this instead:

function centerPopup (page)
{
var w=200, h=135, bw, bh, bl, bt, topPos, leftPos;

if (document.all)
{
bw = document.body.clientWidth;
bh = document.body.clientHeight;
bl = window.screenLeft;
bt = window.screenTop;
}
else if (document.layers)
{
bw = window.outerWidth;
bh = window.outerHeight;
bl = window.screenX;
bt = window.screenY;
}

leftPos = Math.floor((bw-w)/2) + bl;
topPos = Math.floor((bh-h)/2) + bt;

attributes = "width=" + w + ",height=" + h + ",top=" + topPos + ",left=" + leftPos;
popUpWin = window.open (page, "winName", attributes);
}


Other feedback on 'irt.org FAQ Knowledge Base Q1316' - show all

©2018 Martin Webb