PDA

View Full Version : Centering a popup, but doesn't work in WIN IE


ventura
11-15-2002, 05:18 PM
i'm using this code to center a popup, it works in every browser except WIN IE. can anyone see what i can do to make it work in all browsers?


function centerPopup(url,popName,popWidth,popHeight) {
// onClick="return centerPopup('url','popupname',600,400);"

var popWidth;
var popHeight;
var screenWidth = window.screen.width;
var screenHeight = window.screen.height;
var placementx = (screenWidth/2)-((popWidth)/2);
var placementy = (screenHeight/2)-((popHeight+50)/2);
window.open(url,popName,"width="+popWidth+",height="+popHeight+",toolbar=0,location=0,status=0,scrollbars=yes,menubar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+placementx+",screenY="+placementy+",");
}

Roy Sinclair
11-15-2002, 08:09 PM
Bad quoting looks to be the problem, odd that IE would fail though because usually IE works and all the other browsers fail when you don't do thigs properly. The third parameter is supposed to be quoted but you left off the quotes, see below:


window.open(url,popName,"'width="+popWidth+",height="+popHeight+" ,toolbar=0,location=0,status=0,scrollbars=yes,menu
bar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+placementx+",screenY="+placementy+"'");