Centrar una ventana

Romulo
04 de Abril del 2004
necesito una instruccion para cuando abra una ventana o popup de peque帽as dimensiones quede centrada en la pantalla

invitado
04 de Abril del 2004
hola, prueba este codigo. Es muy efectivo:

<html>
<head>
<title>Abrir ventana con bot贸n</title>
</head>

<body bgcolor="#FFFFFF">
<p align="center"><b>Abrir ventana con bot贸n
<script LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function win() {
msg=window.open("","msg","height=200,width=200,left=80,top=80");
msg.document.write("<html><title>Windows!</title>");
msg.document.write("<body bgcolor='white' onblur=window.close()>");
msg.document.write("<center>A帽adir contenido aqu铆.</center>");
msg.document.write("</body></html><p>");

// If you just want to open an existing HTML page in the
// new window, you can replace win()'s coding above with:
// window.open("page.html","","height=200,width=200,left=80,top=80");

}
// End -->
</script>
<!-- STEP TWO: Add the last coding to the BODY of your HTML document -->
</b>
<body>

<body bgcolor="white">

</p>

<center>
<form>
<p><input type="button" value="Abrir pantalla" onclick="win()"> </p>
</form>
</center>
<!-- Or you may use: <a href="javascript:win()">Open Window</a> -->
<p></p>
<center>
<p>&nbsp;</p>
</center>
<p></p>

</body>

</body>

</body>

</html>

Solo debes especificar el ancho de la nueva ventana:

("page.html","","height=200,width=200,left=80,top=80");


Suerte