Questa è una sub che apre una popup di 400x300, NON centrata passandole "Me" ed il nome del file della popup:
codice:
public static void Popup(System.Web.UI.Page Pagina, string Link)
{
string js = "window.open('" + Link + "','popup','width=400,height=300');";
if ((!Pagina.ClientScript.IsStartupScriptRegistered("clientscript_popup"))) {
Pagina.ClientScript.RegisterStartupScript(Pagina.GetType, "clientscript_popup", js, true);
}
}
Questo è il codice Javascript per centrare le popup:
codice:
<script language="javascript">
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
</script>
ESERCIZIO: Prova ad adattarla...