[thelist] centering a popup
Anthony Baratta
Anthony at Baratta.com
Tue Oct 9 14:21:06 CDT 2001
At 12:13 PM 10/9/2001, you wrote:
>is there any way i can have a popup window automatically center itself
>onscreen, regardless of screen res?
Here's how I do it....(There are better ways. ;-)
function openWindow(theURL,winName,winWidth,winHeight,otherFeatures) {
var x = 0;
var y = 0;
x = (screen.availWidth - 12 - winWidth) / 2;
y = (screen.availHeight - 48 - winHeight) / 2;
if (otherFeatures != "") {otherFeatures = "," + otherFeatures}
var features = "screenX=" + x + ",screenY=" + y + ",width=" + winWidth +
",height=" + winHeight+",top="+y+",left="+x+"'" + otherFeatures
var NewWindow = window.open(theURL,winName,features);
NewWindow.focus();
}
[a
href="javascript:openWindow('./pagename.html','_winName','230','180','scrollbars=no,resize=no');"]
---
Anthony Baratta
President
Keyboard Jockeys
"Conformity is the refuge of the unimaginative."
More information about the thelist
mailing list