CodeGrabber
{ USER }
posts: 23
last: 28-Apr-2008
TITLE: opening a popup window with specified parameters and arguments
DESCRIPTION: opens a popup a window with the specified width and height. can be centered in the screen
Submitted: 28-Nov-2007 04:34:28 ( 1yrs 5w 6d 4h ago ) Language: JavaScript (*.js *.jscript *.jsb)
Views: 179 Lines of Code: 30 LINES
Rating:
rate: star1
star2
star3
star4
star5
dstar1
dstar2
dstar3
dstar4
dstar5  ( rated! )
  { 0.00 / 5 }
Difficulty: Intermediate
Bookmark
function openAWindow( pageToLoad, winName, width, height, center)
{
    xposition=0; yposition=0;
    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }
	
	//0 => no
	//1 => yes
    var args = "";
    	args += "width=" + width + "," + "height=" + height + ","
		+ "location=0,"
		+ "menubar=0,"
		+ "resizable=0,"
		+ "scrollbars=0,"
		+ "statusbar=false,dependent,alwaysraised,"
		+ "status=false,"
		+ "titlebar=no,"
		+ "toolbar=0,"
		+ "hotkeys=0,"
		+ "screenx=" + xposition + ","  //NN Only
		+ "screeny=" + yposition + ","  //NN Only
		+ "left=" + xposition + ","     //IE Only
		+ "top=" + yposition;           //IE Only
		//fullscreen=yes, add for full screen
    	var dmcaWin = window.open(pageToLoad,winName,args );
    	dmcaWin.focus();
    //window.showModalDialog(pageToLoad,"","dialogWidth:650px;dialogHeight:500px");
}