Codice PHP:
//centra la popUp in base alle dimensioni dello schermo
function popupCentrata(width,height) {
var dim = new Array();
var w = width;
var h = height;
dim['left'] = Math.floor((screen.width-w)/2);
dim['top'] = Math.floor((screen.height-h)/2);
dim['width'] = w;
dim['height'] = h;
return dim;
}
function openPopUp(popwidth,popheight,page,popname){
var screendim = popupCentrata(popwidth,popheight);
var l = screendim['left'];
var t = screendim['top'];
var w = screendim['width'];
var h = screendim['height'];
finestra = window.open(page,popname,"width="+w+",height="+h+",left="+l+",top="+t+",toolbar=no, location=no,statusbar=no,menubar=no,scrollbars=no,resizable=no");
return finestra;
}
openPopUp(300,200,"pagina.php","namePop");