Click to See Complete Forum and Search --> : Pop-up at center of page


cali2copi
12-16-2004, 05:57 AM
Hi everybody,
I've made a pop-up for a web page when it loads, but a would like it to appear at the center of the page, not in a corner. Can somebody help me? I'm sure it's a simple question... Thanks!

coothead
12-16-2004, 06:55 AM
Hi there cali2copi

and a warm welcome to these forums :)

Try this...
<script type="text/javascript">
<!--

var w=500; /* popup window width*/
var h=440; /* popup window height*/

var l=(screen.width-w)/2; /*this centers horizontally*/
var t=(screen.height-h)/2; /*this centers vertically*/

var url="http://www.google.com";

var features="left="+l+",top="+t+",width="+w+",height="+h+",scrollbars=auto";

function popItUp() {
window.open(url,"",features);
}

//-->
</script>

<a href="javascript:void(popItUp())">google</a>

coothead

Stephen Philbin
12-16-2004, 07:59 AM
Or you might even prefer to use this:






It's a great alternative.